Posted By

scriptmakingcom on 09/02/07


Tagged

CURLgrabberscraper


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

vali29
bryandease


Basic PHP content grabber using CURL


 / Published in: PHP
 

URL: http://www.oooff.com/php-scripts/basic-curl-scraping-php/basic-scraping-with-curl.php

  1. <?
  2. $url = "oooff.com";
  3. $ch = curl_init($url);
  4. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  5. $curl_scraped_page = curl_exec($ch);
  6. curl_close($ch);
  7. echo $curl_scraped_page;
  8. ?>
  9.  
  10. <?php
  11. $data = file_get_contents('http://search.msn.com/results.aspx?q=site%3Afroogle.com');
  12. $regex = '/Page 1 of (.+?) results/';
  13. preg_match($regex,$data,$match);
  14. var_dump($match);
  15. echo $match[1];
  16. ?>

Report this snippet  

You need to login to post a comment.