http urlを使用してSMS APIを呼び出そうとしています。curlを使用してURLを呼び出そうとしています。間違っている。CURL:http urlを呼び出そうとしたときに不正な要求が発生しました
// create a new cURL resource
$ch = curl_init();
$string1 = "http://api.znisms.com/post/smsv3.asp?userid=alpesh67&apikey=74c6314840a16c5e7db00415a03181f7&message= Congratulation you have been successfully registered in the Placement Management System \n Email:".$email."\n Password:".$password."&senderid=PMS12345&sendto=".$contactno."";
echo $string1;
// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, $string1);
// grab URL and pass it to the browser
curl_exec($ch);
//close cURL resource, and free up system resources
curl_close($ch);
//SMS END
私は次のエラーを取得する:
http://api.znisms.com/post/smsv3.asp?userid=alpesh67&apikey=74c6314840a16c5e7db00415a03181f7&message= Congratulation you have been successfully registered in the Placement Management System Email:[email protected] Password:123456789&senderid=PMS12345&sendto=9773396773
Bad Request
私は、Webブラウザから作成したURLを呼び出すだけで、メッセージのスペースは問題ではありません。次のようにカールヘイダーを含めることをお勧めします。しかし、私はまだあなたのソリューションを試して、私はまだエラーが発生します。 – Jonah
更新されたエラーがありますか? urlencode()を追加すると、エラーのURLの内容が異なるはずです。 – Drahkar
urlencode関数は私のためのトリックでした。ありがとうございます – noobcode