Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

October 15, 2015

Using CURL for parsing websites on PHP

When a site you try to parse don't allow
file_get_contents("http:Site URL")
use CURL to parse


$head = array( "User-Agent: Mozilla/5.0 (iPad; CPU OS 7_1_2 like Mac OS X) AppleWebKit/537.51.2 (KHTML, like Gecko) Version/7.0 Mobile/11D257 Safari/9537.53", "Cookie: NNB=;" );
$site = "http://Name of the Site;
$a = curl_init(); curl_setopt($a, CURLOPT_URL, $site); curl_setopt($a, CURLOPT_HTTPHEADER, $head); curl_setopt($a, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_COOKIEFILE, "/tmp/NNB");
$show  = curl_exec($a); curl_close($a);

echo $show;


1 comment:

  1. This comment has been removed by a blog administrator.