开发者

@file_get_contents() and curl failed to get page contents, I need alternate code

some sites are blocking @file_get_contents and the curl code also. I need code(PHP) that circumvents that problem. I only need to get the page contents so I can extra开发者_运维知识库ct the title.


You probably need to set the user agent string to emulate a "real" browser:

curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.1; rv:2.0) Gecko/20110319 Firefox/4.0');
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜