CURLを使用してphpサイトを開発していますが、ローカルサーバーでのみ機能し、ライブサーバーでは機能しません。「ホストに接続できませんでした」というエラーが返されます。
CURL iSがライブサーバーにインストールされており、テスト済みです。
SSLがライブサーバーにインストールされており、curlを使用してポート9301に接続しています
すなわち;http://xx.xxx.xx.xxx:9301/test。
これが私のコードです:
$request = 'http://xx.xxx.xx.xxx:9301/test';
// The request parameters
$context = 'something';
// urlencode and concatenate the POST arguments
$postargs = 'xmlRequest='.urlencode($context);
$session = curl_init($request);
// Tell curl to use HTTP POST
curl_setopt ($session, CURLOPT_POST, true);
// Tell curl that this is the body of the POST
curl_setopt($ch, CURLOPT_PORT, '9301');
curl_setopt ($session, CURLOPT_POSTFIELDS, $postargs);
// Tell curl not to return headers, but do return the response
curl_setopt($session, CURLOPT_HEADER, false);
curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($session);
//echo curl_getinfo($session);
echo $err = 'Curl error: ' . curl_error($session);
curl_close($session);
echo $response;
私のテストから、Curl経由でポートアドレスに接続できないことは明らかです。ポートアドレスに接続するには、サーバー設定を変更する必要がありますか?