Get search results with cURL

0

I'm working on a custom search engine, example I want to gather information from a particular Google search and display, I started using the cURL below:

$curl = curl_init();

$search_string = "fome no mundo";

$url = "http://www.google.com.br/search?q=";

curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);

$result = curl_exec($curl);

preg_match_all("/<div class=\"r\"<\/h3>/", $result, $matches); // aqui defino a div do resultado que quero exibir

curl_close($curl);

I get the following error "302 Moved The document has moved here ", what am I missing and what alternatives do I have?

    
asked by anonymous 08.05.2018 / 01:43

0 answers