开发者

php curl strange question

开发者 https://www.devze.com 2023-01-25 20:41 出处:网络
When i create only one curl object $ch = curl_init(); and then go on many site pages, it\'s ok (if i pass cookie), but if i create for each request new curl object, even if i set cookie, site anyway r

When i create only one curl object $ch = curl_init(); and then go on many site pages, it's ok (if i pass cookie), but if i create for each request new curl object, even if i set cookie, site anyway redirect me to login page. what does object curl contains else that allow site recognize my curl client? what mus开发者_如何学Ct i set except cookie?


The remote server might be checking your user agent. Try setting it:

$ua = 'Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.12) '.
      'Gecko/20101027 Ubuntu/9.10 (karmic) Firefox/3.6.12';

curl_setopt($ch, CURLOPT_USERAGENT, $ua);
0

精彩评论

暂无评论...
验证码 换一张
取 消