志凡'S BLOG

关注PHP,WEB开发,jquery ,PHP教程,程序优化,还有一些些互联网的乱七八糟的一些东西

Archive for the ‘https’ tag

php获取https下的内容

without comments

直接用file_get_contents,

$url = ('https://xxx.com");  
file_get_contents($url);

会报错;

Warning: file_get_contents(https://xxx.com) [function.file-get-contents]: failed to open stream: No such file   or directory in D:wampwwwgrabber_clientindex.php on line 3

用curl的方式是可以的:

<?php
$url = ('https://xxx.com');
$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);
print_r($result);
?>

重点是以下两句:
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);

Written by zifa

五月 7th, 2010 at 12:22 上午

Posted in PHP相关

Tagged with

snoopy https 问题的解决

with 3 comments

今天在使用snoopy进行https的post请求,开始无法正常使用,有两个问题,因为https使用curl命令所以要安装并设置对。
var $curl_path = “/usr/local/bin/curl”; 这里设置对你的路径。

由于https默认都是443,snoopy似乎没有进行处理。
解决办法在所有case “https”:下面增加
$this->port = 443;

Written by zifa

六月 25th, 2009 at 10:31 下午

Posted in PHP相关

Tagged with ,