Lefora Free Forum
login join
Loading
501 views

Accessing a website Page Source

Page 1
1–2
rookie - member
2 posts

I am trying to figure out a way to access a websites page source and then do a search inthe page source for certain words.

Can anyone help?

I could really use some good documentation and/or some example code.


Thanks in advance!

Paul

?
288 posts

Ah yes, this is an easy one.  You just do a get on the web server and you're done.


int main3(int argc,const char* argv[])
{
int result = 0 ;
    NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
if ( argc != 2 ) {
NSLog(@"syntax: httpget url") ;
result = -1 ;
} else {
NSString* sURL  = [[NSString alloc]initWithCString:argv[1]];
NSURL*    uURL  = [NSURL URLWithString:sURL] ;
NSString* sPage = [[NSString alloc]initWithContentsOfURL:uURL] ;

NSLog(@"%@",sPage) ;
}

    [pool drain];
return result ;
}

561 /Users/rmills/Projects/httpget/build/Debug> httpget http://clanmills.com/robin.shtml
2010-01-20 23:02:43.905 httpget[13413:903] <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<HTML><HEAD>
.......... lots of stuff deleted .........
</body>
</html>
562 /Users/rmills/Projects/httpget/build/Debug> 

__________________
Page 1
1–2

Locked Topic


You must be a member to post in this forum

Join Now!