file_get_contents是可以的,
成都創(chuàng)新互聯(lián)公司專注于韓城網站建設服務及定制,我們擁有豐富的企業(yè)做網站經驗。 熱誠為您提供韓城營銷型網站建設,韓城網站制作、韓城網頁設計、韓城網站官網定制、成都小程序開發(fā)服務,打造韓城網絡公司原創(chuàng)品牌,更為您提供韓城網站排名全網營銷落地服務。
?php
echo?"meta?http-equiv='Content-Type'?content='text/html;?charset=utf-8'?/";
$m?=?file_get_contents(";client_id=319cdac7553fa298");
print_r(json_decode($m));
?
輸出結果:
不要用file_get_contents函數。
用snoopy的類,網上有snoopy.class.php,你自行百度查找。
snoopy的類可以設置$proxy_host參數,設置代理主機,$proxy_port是代理主機端口。你下載一個下來,網上的教程很多,看看應該明白。
1、在asp網站上生成 xml新聞源 php中調用
2、php直接遠程讀取asp上的網頁 下面發(fā)段php遠程讀取的函數
function get_content($url)
{
$buf=parse_url($url);
if($buf['scheme']=="http")//如果是URL
{
$host=$buf['host'];
$page=$buf['path'];
if(trim($buf['query'])!=="") $page.="?".trim($buf['query']);
$myHeader="GET $url HTTP/1.1\r\n";
$myHeader.="Host: $host\r\n";
$myHeader.="Connection: close\r\n";
$myHeader.="Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5\r\n";
$myHeader.="Accept-Language: zh-cn,zh;q=0.5\r\n";
$myHeader.="Accept-Charset: gb2312,utf-8;q=0.7,*;q=0.7\r\n";
$myHeader.="User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.7.6) Gecko/20050226 Firefox/1.0.1 Web-Sniffer/1.0.20\r\n";
$myHeader.="Referer: \r\n\r\n";
$server=$host;
$port=80;
$res="";
if(false!==($fp = @fsockopen ($server, $port, $errno, $errstr, 30)))
{
@fputs ($fp, $myHeader);
while (!@feof($fp)) $res.= @fgets ($fp, 1024);
@fclose ($fp);
}
else return false;
if(strlen($res)==0) return false;
return $res;
}
else//如果是本地文件
{
$fileName=$url;
if(false!==@file_exists($fileName))
{
if(false!==($buf=@implode("",file($fileName)))@strlen($buf)0)
{
return $buf;
}
else return false;
}
else return false;
}
}