How to fetch / extract data using CURL in PHP?
This is an example that fetches / extracts the information that we get while we search in google as define:words.
Open google.com and type define:zany in search box and press enter.
You will get list for definition of word zany.
In this example, using curl i am demonstrating to fetch the data from that page starting with <ul> tag to </ul> tag.
$url = "http://www.google.com/search?q=define:zany";
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$first= stripos($var,'<ul’,0) ;
$second= stripos($var,'</ul>’,0) ;
About the Author
16 Comments on “How to fetch / extract data using CURL in PHP?”
Write a Comment
Gravatars are small images that can show your personality. You can get your gravatar for free today!