faqts : Computers : Programming : Languages : PHP : Common Problems

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

20 of 28 people (71%) answered Yes
Recently 7 of 10 people (70%) answered Yes

Entry

How do I grab the HTML source code of a page out of my domain using PHP?

Mar 30th, 2002 02:45
Edwin Chan, Ritchie,


Try the following:
 // for grabbing html sources in your domain by reading from url 
 //$source = file ("http://www.php.net/", "r");
 // for grabbing html in your domain by reading from shared folder
 $source = file ("g:/shared/a.html", "r");
 for ($i=0; $i<count($source); $i++)
   echo htmlspecialchars($source[$i])."<br>";