PHP使用Curl +访问经过审查的网站+

时间:2019-07-13 01:51:14

标签: php curl bots

我国禁止使用维基百科。我想使用curl逻辑从该站点提取数据。我可以使用代理吗?你能告诉我细节和方法吗?

$ch = curl_init();
    //curl_setopt ($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9b5) Gecko/2008032620 Firefox/3.0b5');
    curl_setopt($ch,CURLOPT_USERAGENT,"Mozilla/5.0 (compatible; Santa1923/bot)");
    curl_setopt ($ch, CURLOPT_HEADER, false);
    curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, 0);
    curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, 2);

    curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, true);
    curl_setopt ($ch, CURLOPT_TIMEOUT, 30);
    curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, 30);

    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);

    curl_setopt($ch, CURLOPT_PROXY, ' 192.241.129.11');
    curl_setopt($ch, CURLOPT_PROXYPORT, '8118');
    curl_setopt($ch, CURLOPT_PROXYTYPE, 'HTTP');


    $url = 'https://www.wikipedia.com';
    //$url = 'Google';


    curl_setopt($ch, CURLOPT_URL, $url);

    $data = curl_exec($ch);

    echo $data;

我想从被禁止的站点中提取数据。你能帮忙吗?

0 个答案:

没有答案