第一种:
直接使用函数:
file_get_contents();
前提是需要php编译时候支持 ssl,也就是加上with=openssl选项,windows则需要将extention=openssl.dll选项打开
举例:
echo file_get_contents('
' target='_blank'>
[/reply]');
第二种:
使用CURL。当然,你的php需要支持curl,linux和windows都需要配置(此处省略,感兴趣的凯粉可以自行百度)
举例:
ob_start();
$url = ('
' target='_blank'>
[/reply]');
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
$result = curl_exec($ch);
$r = ob_get_contents();
echo $r;
原理是将内容打印到缓冲区,然后将缓冲区内容赋值给一个变量。


举报 0