Wednesday, 27 May 2015

PHP-Curl-web-scrapping-example

<?php

  $curl_handle=curl_init();
  
  curl_setopt($curl_handle,CURLOPT_URL,'http://www.vissicomp.com');
  
  curl_setopt($curl_handle,CURLOPT_CONNECTTIMEOUT,2);
  
  curl_setopt($curl_handle,CURLOPT_RETURNTRANSFER,1);
  
  $buffer = curl_exec($curl_handle);
  
  curl_close($curl_handle);
  
  if (empty($buffer))
{
      print "Nothing returned from url.<p>";
  }
  
  else
{

      print $buffer;

  }
?>

No comments:

Post a Comment