从远程主机检索cookie并将其传递回客户端

时间:2016-05-31 12:55:12

标签: php curl cookies

我尝试使用一个效果很好的小脚本从远程主机上抓取Cookie:

// create a new cURL resource
$ch = curl_init();

// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, "http://www.example.com/");
curl_setopt($ch, CURLOPT_HEADER, TRUE);
curl_setopt($ch, CURLOPT_NOBODY, TRUE);
curl_setopt($ch, CURLOPT_BINARYTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
curl_setopt($ch, CURLOPT_COOKIE, TRUE);

// grab URL and pass it to the browser
$opt = curl_exec($ch);

// close cURL resource, and free up system resources
curl_close($ch);

我想知道如何将它们传回客户端?

谢谢

0 个答案:

没有答案