cURLなしでPHP呼び出しを行う(ここにあります:http ://wezfurlong.org/blog/2006/nov/http-post-from-php-without-curl/ )が、応答には約10〜15秒かかります戻って。現在、エラーが発生しています。これを機能させる方法はありますか?私はset_time_limitを無駄にしようとしました。
コード:
function DoPostRequest($url, $data, $optional_headers = null)
{
$params = array('http' => array('method' => 'POST', 'content' => $data));
if($optional_headers != null) {
$params['http']['header'] = $optional_headers;
}
$ctx = stream_context_create($params);
try {
$fp = fopen($url, 'rb', false, $ctx);
$response = stream_get_contents($fp);
} catch (Exception $e) {
echo 'Exception: '.$e->getMessage();
}
return $response;
}
そしてエラー:
Notice: fopen(): Content-type not specified assuming application/x-www-form-urlencoded in <php url> on line 81 Warning: fopen(http://localhost:59396/Update.ashx): failed to open stream: HTTP request failed! HTTP/1.1 100 Continue in <php url> on line 81 Warning: stream_get_contents() expects parameter 1 to be resource, boolean given in <php url> on line 82 bool(false)