あなたの助けが必要です!cURL を使用して投稿を送信しましたが、応答が空白です (boolean false)。ブラウザを押すだけのようにブラウザにデータを投稿するとhttps://www.example.com/myaccount/transfer.php?username=usernamer&password=pass&deposit=5
、次の結果が表示されます。
1 0 success Your account has been deposited
.
ブラウザーのソース コードを表示すると、結果は次のようになります。
<?xml version="1.0" encoding="utf-8"?>
<TransferResponse>
<version>1</version>
<result>0</result>
<resultstring>success</resultstring>
<description>Your account has been deposited</description>
</TransferResponse>
私のcURLコードを添付しましょう:
<?php
$config = array
(
"url" => "https://www.example.com/myaccount/",
"transfer" => "transfer.php",
"browser" => "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.16 (KHTML, like Gecko) Chrome/10.0.648.204 Safari/534.16"
);
$postFields = "username=username&password=pass&deposit=5";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $config['url'] . $config['transfer']);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_CAINFO, getcwd() . "/cert/GeoTrustGlobalCA.crt");
curl_setopt($ch, CURLOPT_COOKIEJAR, "cookie.txt");
curl_setopt($ch, CURLOPT_COOKIEFILE, "cookie.txt");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postFields);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_USERAGENT, $config['browser']);
curl_setopt($ch, CURLOPT_REFERER, $config['url']);
curl_setopt($ch, CURLOPT_HEADER, true);
$content = curl_exec($ch);
var_dump($content);
var_dump(curl_getinfo($ch));
curl_error($ch);
curl_close($ch);
echo $content;
?>
cURL で結果を取得するのを手伝ってください。私は多くの方法を試しました。私は 2 日間連続でインターネットをサーフィンしました。結局ここで質問することにしました。誰かが問題が何であるかを理解できますか? 以下が行われます。
- コマンド ラインは、
http
(https ではなく)の結果をxml として表示します。 - コマンド ラインは次の結果を返します
https
(http ではない) : 失敗: エラー番号: 60。詳細: エラー: 14090086: SSL ルーチン: SSL3_GET_SERVER_CERTIFICATE: 証明書の検証に失敗しました http
(https ではない)の cURL 結果は、www.example.com の警告ページをリダイレクトするだけですvar_dump($content); and var_dump(curl_getinfo($ch));
結果は次のとおりです。boolean false array (size=26) 'url' => string ' https://www.example.com/myaccount/transfer.php' (length=46) 'content_type' => null 'http_code' => int 0 'header_size' => int 0 'request_size' => int 0 'filetime' => int -1 'ssl_verify_result' => int 0 'redirect_count ' => int 0 'total_time' => float 1.451 'namelookup_time' => float 0 'connect_time' => float 0 'pretransfer_time' => float 0 'size_upload' => float 0 'size_download' => float 0 'speed_download' => float 0 'speed_upload' => float 0 'download_content_length' => float -1 'upload_content_length' => float -1 'starttransfer_time' => float 0 'redirect_time' => float 0 'certinfo' => 配列 (サイズ = 0) 空 'primary_ip' => 文字列 '177.70.43.10' (長さ = 11) 'primary_port' => int 443 'local_ip' => 文字列 '192.168.11.9' (長さ = 0) 'local_port' => int 0 'redirect_url' =>文字列 '' (長さ = 0)