curlでurl encoded xmlフィールドを送信しようとしています。 URL以外のデータを送信する別の方法はありますか?私はこれを試したが、 "No URL set!"エラー。 1についてはXMLデータをGETパラメータで送信するPHP Curl
$ch = curl_init();
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_URL, 'http://setmpos.ykb.com/PosnetWebService/XML');
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 100);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST /PosnetWebService/XML HTTP/1.1
Host: setmpos.ykb.com
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)
Pragma: nocache
Accept-Language: tr
Content-Type: application/x-www-form-urlencoded
Content-Length: ".strlen($url)."
$url");
$response = curl_exec($ch);
if (curl_errno($ch)) {
$message = curl_error($ch);
}
これは動作しませんが、なぜですか? curl_setopt($ ch、CURLOPT_GET、1); curl_setopt($ ch、CURLOPT_GETFIELDS、$ GETFIELDS); – user305015
質問が解決しなかった理由を教えてください:http://stackoverflow.com/search?q=post+curl+php – Gordon