cURLを使用せずにHTTP POSTを送信するためにPHP5で動作する次のコードがあります。これを PHP 4.3.0 以降で動作させたい:
$opts = array('http' =>
array(
'method' => 'POST',
'header' => "Content-type: application/x-www-form-urlencoded\r\n" . "Content-Type: application/json\r\n",
'content' => $query
)
);
$context = stream_context_create($opts);
$result = file_get_contents($url, false, $context);
HTTP コンテキストは PHP5 でのみサポートされています。とにかくこれを PHP 4.3.0 で動作させる方法はありますか? PHP5 または cURL がインストールされていない場合は、フォールバック メソッドが必要です。