What Im trying to do is use PHP to scrape a website of a url I enter into a parameter.
I want the whole raw source code.. But thats not all..
I want it then saved into an html page, and onto the local server of the php script.
Is there a Easy Snippet for this? or can someone easily write me up a code?
For example
I want to scrape http://google.com
So for instance, mysite.com/scrape.php?url=http://google.com
I want it to save the front page of google into http://mysite.com/scraped/google.com.html
Here’s a script that will save the contents of the specified url into a file named
scraped.html:To use a url in the call to
file_get_contents()you must enableallow_url_fopenin yourphp.inifile.Of course this will only save the actual source of the requested url and not any other resources, such as images, scripts and stylesheets.