Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

parse source code

Status
Not open for further replies.

tty0

Programmer
Nov 13, 2002
108
GB
is there a function that you can pass a url to and return the source code to a variable so it can be parsed?


'mi casa es su casa'
]-=tty0=-[
 
You would have to use something like "cURL" or "wget" to fetch the HTML from the remote machine.
 
There are also some easy sollutions, like iframe.
iframe is not 100% supported by all browsers, so it might not be a good idea.

fopen -- Opens file or URL

I think you should look at:

There are some sample codes there that you can try for your liking.

Olav Alexander Mjelde
Admin & Webmaster
 
cheers eric that was the one but it was getting late and i couldnt remember.

thanks butcher too, i'll bear that one in mind in future :)

'mi casa es su casa'
]-=tty0=-[
 
A note:
fopen() can only open pages via http:// if the corresponding wrappers are enabled.
cURL is an optional module which needs to be compiled in the PHP (at least on *nix OSs).
I usually recommend to use socket commands. fsockopen() to the host and then I construct a GET request. You could build a nice little function that can be used in many scenarios.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top