Basic PHP content grabber using CURL


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  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. echo $curl_scraped_page;
  7. ?>
  8.  
  9. <?php
  10. $data = file_get_contents('http://search.msn.com/results.aspx?q=site%3Afroogle.com');
  11. $regex = '/Page 1 of (.+?) results/';
  12. preg_match($regex,$data,$match);
  13. var_dump($match);
  14. echo $match[1];
  15. ?>

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

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.