我已经使用以下命令安装了php的http扩展名:
**pecl install pecl_http**它成功了,但是我在我的/usr/lib/php5/20121212+lfs文件夹中找不到http.so扩展。我有什么事要做吗?
发布于 2015-07-25 06:56:40
我使用以下函数实现了http发布。我刚在网上找到的。
函数http_post_lite($url,$data,$headers=null) {
$data = http_build_query($data);
$opts = array('http' => array('method' => 'POST', 'content' => $data,'header' => "Content-Type: application/x-www-form-urlencoded\r\n"));
if($headers) {
$opts['http']['header'] = $headers;
}
$st = stream_context_create($opts);
$fp = fopen($url, 'rb', false, $st);
if(!$fp) {
return false;
}
return stream_get_contents($fp);
}https://stackoverflow.com/questions/31409130
复制相似问题