Scraping website content with PHP using Curl
The function below takes a URL and connects to it and returns all the contents.
How do I use it?
See the code below for an example implementation of the function.
$content will then become the full HTML of the page, so outputting it will replicate the page in it's entirety. Do with it what you will.
Enjoy this article? Why not subscribe to the full RSS feed?





Showing most recent 4 of 4 comments
inside the two forward slashes you would put
something like this
< a h r e f = ' ( . * ? ) ' >
hopefully the form doesnt break this. if it doesnt then just remove spaces.
$content = get_content("http://www.somewebsite.com");
preg_match("//",$content,$output);
echo $output[1];
// That will output the first url it comes across within an a href tag.
You can also use preg_match_all to grab them all and lots of other things.
thx
http://apexvideo.blogspot.com