title: How to use Google Search query in PHP?
body: <p>I am trying to use Google Search query in my website, I need to get website URLs for the text I sent to the query, the code works fine for limited results, but then it stops working after some time, maybe Google disables it for some time?</p>
  
  <p>Here is the code:</p>
  
  <pre><code>        $cleanQuery = str_replace(" ","+",$text);
          $url = 'http://www.google.com/search?q='.$cleanQuery;
          $scrape = file_get_contents($url);
  </code></pre>
  
  <p>$text is the text entered by the user while searching. But the problem is it works only for sometime, then it stops.</p>
  
  <p>Working example: <a href="http://www.alleffort.com/tools/findurl.php" rel="nofollow noreferrer">http://www.alleffort.com/tools/findurl.php</a></p>
  
  <p>If you enter some text in the textarea, then on submits it should retrieve all the related information, but it is not working.</p>