[PHP] parse html code

2002-09-26 Thread Rodrigo

I want to enter an url, get the html code, and obtain from this all the referenced 
urls.
Anybody knows the way to do that?

Bergus



Re: [PHP] parse html code

2002-09-26 Thread Khalid El-Kary

hi,
you have two things to do here, first obtain the file, second get urls 
inside it ...

about the first you can get the file so easily using the functions fopen, 
fread and fclose

int fopen ( string filename, string mode [, int use_include_path [, resource 
zcontext]] )

//for example (this will open for writing only)
$file=fopen(http://www.anydomain.com/index.html,w;);

//follow the other php file system functions to read the file and obtain a 
string from it.
http://it3.php.net/manual/en/ref.filesystem.php

about getting URLs from the file this could be done through string functions 
(by applying them on the returned string)

refer to functions strpos, substr, substr_count, strlen  in the php manual
http://it3.php.net/manual/en/ref.strings.php

hopefully this will help

yours,
khalid






_
Chat with friends online, try MSN Messenger: http://messenger.msn.com


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php