HONG 发表于 2013-9-14 17:35:36

luguokankan 发表于 2013-9-14 17:32 static/image/common/back.gif
做出来记得给我一份啊

您这样的大牛,博士生导师级别的, 拿小弟开玩笑吧呵呵   :)

这个是我实现的代码:

<?php
$url = 'http://arcadegameworld.com/play/stone-age-mahjong-connect/';

$header = get_header($url);
echo $header;

function get_header($url){
    $ch= curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_HEADER, true);
    curl_setopt($ch, CURLOPT_NOBODY,true);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER,true);
    //curl_setopt($ch, CURLOPT_FOLLOWLOCATION,true);
    curl_setopt($ch, CURLOPT_AUTOREFERER,true);
    curl_setopt($ch, CURLOPT_TIMEOUT,30);
    curl_setopt($ch, CURLOPT_HTTPHEADER, array(
    'Accept: */*',
    'User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)',
    'Connection: Keep-Alive'));
    $header = curl_exec($C);
    return $header;
}
?>



运行后的结果:




HTTP/1.1 200 OK
Date: Sat, 14 Sep 2013 09:28:54 GMT
Server: Apache
X-Pingback: http://arcadegameworld.com/xmlrpc.php
Link: <http://arcadegameworld.com/?p=3155>; rel=shortlink
Vary: Accept-Encoding
Connection: close
Content-Type: text/html; charset=UTF-8








luguokankan 发表于 2013-9-14 17:48:10

HONG 发表于 2013-9-14 17:35 static/image/common/back.gif
您这样的大牛,博士生导师级别的, 拿小弟开玩笑吧呵呵   

这个是我实现的代码:


打算用php来做评论吗? 可以使用rollingcurl库

https://github.com/takinbo/rolling-curl


good luck!

中国胡子 发表于 2013-9-16 13:03:40

有位兄弟回答了,确实可以直接在post里面看

跳舞的机器人 发表于 2013-10-4 09:09:25

这个原理不知道。。这个行业水深,大神很多
页: 1 [2]
查看完整版本: Wordpress 评论求教