簡體   English   中英

pecl安裝pecl_http無法正常工作。

[英]pecl install pecl_http not working.

我已經使用以下命令為php安裝了http擴展名,

**pecl install pecl_http**

它成功,但是我在/ usr / lib / php5 / 20121212 + lfs文件夾中找不到http.so擴展名。 我有什么需要做的嗎?

我已經使用以下功能實現了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);
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM