我有一個捲曲功能,如下所示。要加載此功能,我使用<img src="http://site.com/pxl.php?i=1.jpg" height="1" width="1" />
,但是當我做這個餅乾不會被添加到我的瀏覽器。有沒有辦法爲:當在URL中的捲曲來看,我從URL收集餅乾並將其設置爲使用的瀏覽器訪問<img src="http://site.com/pxl.php?i=1.jpg" height="1" width="1" />
如何設置捲曲瀏覽器餅乾
function get_content($url,$ref)
{
$browser = $_SERVER['HTTP_USER_AGENT'];
$ch = curl_init();
$header[0] = "Accept: text/xml,application/xml,application/xhtml+xml,";
$header[0] .= "text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5";
$header[] = "Cache-Control: max-age=0";
$header[] = "Connection: keep-alive";
$header[] = "Keep-Alive: 300";
$header[] = "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7";
$header[] = "Accept-Language: en-us,en;q=0.5";
$header[] = "Pragma: "; // browsers keep this blank.
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_USERAGENT, $browser);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_REFERER, $ref);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_AUTOREFERER, false);
$html = curl_exec($ch);
curl_close ($ch);
return $html;
}
不是它是瀏覽器和捲曲工作在不同的進程空間。那麼如何通過捲曲設置cookie將會被瀏覽器看到? –
以及推薦人和useragent的同樣的事情,但這是可以改變的 – user2002220
referrer和用戶代理不要在磁盤上存儲任何東西,因爲cookie存儲在磁盤上。 –