The example in this article describes the way in which PHP uses Curl to spoof landing crawl data by adding cookies. Share to everyone for your reference, specific as follows:
Some Web pages must be logged to see, this time want to crawl information must be in the header pass the cookie value to get
1, the first landing site, open Firebug can see the corresponding cookies to copy these cookies can be used
2,
<?php header ("content-type:text/html;
Charset=utf8 ");
$ch =curl_init ();
curl_setopt ($ch, Curlopt_url, ' http://www.babytree.com/user/picjournal.php ');
$header = Array ();
curl_setopt ($ch, curlopt_post,true);
curl_setopt ($ch, Curlopt_postfields, $fields);
curl_setopt ($ch, curlopt_returntransfer,true);
curl_setopt ($ch, curlopt_header,true);
curl_setopt ($ch, Curlopt_httpheader, $header); curl_setopt ($ch, Curlopt_cookie, ' b=115.100.62.7.1401937092035530; bdshare_firstime=1401937092199; __myutma=
122328856.1548793539.1401937093.1408503164.1408694138.69; ');
$content = curl_exec ($ch);
echo "<pre>";p Rint_r (Curl_error ($ch)); echo "</pre>";
echo "<pre>";p Rint_r (Curl_getinfo ($ch)); echo "</pre>";
echo "<pre>";p Rint_r ($header); echo "</pre>";
echo "</br>", $content;
More interested in PHP related content readers can view the site topics: "Php Curl Usage Summary", "PHP operation and operator Usage Summary", "PHP Network Programming Skills Summary", "PHP Basic Grammar Introductory Tutorial", "PHP operation Office Document skills Summary (including Word, Excel,access,ppt), "The PHP date and time usage summary", "PHP object-oriented Programming Introduction Tutorial", "PHP string (String) Usage Summary", "Php+mysql Database operation Introduction Tutorial" and "PHP common database Operation skill Summary"
I hope this article will help you with the PHP program design.