Http Error 400. The Request Is Badly Formed. Curl
Contents |
here for a quick overview of the site Help Center Detailed answers to
Http Error 400. The Request Is Badly Formed. Chrome
any questions you might have Meta Discuss the workings and policies curl bad request 400 of this site About Us Learn more about Stack Overflow the company Business Learn more bad request http error 400. the request is badly formed. about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack
Http Error 400 Bad Request
Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up CURL: BAD REQUESt error when trying to call http url up vote 0 down vote favorite 1 I am trying to call an sms api using a http
Urlencode() In Php
url .I am trying to call the url using curl in php.I get a BAD REQUEST error .Please explain what I am doing wrong. // 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 I get the following error: http://api.znisms.com/post/smsv3.asp?userid=alpesh67&apikey=74c6314840a16c5e7db00415a03181f7&message= Congratulation you have been successfully registered in the Placement Management System Email:alpeshhi@gmail.com Password:123456789&senderid=PMS12345&sendto=9773396773 Bad Request php curl web share|improve this question asked Mar 13 '12 at 11:34 Jonah 42611019 add a comment| 3 Answers 3 active oldest votes up vote 8 down vote accepted You can't use spaces in a URL. You need to url encode this string: &message= Congratulation you have been suc
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of http://stackoverflow.com/questions/9683186/curl-bad-request-error-when-trying-to-call-http-url 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up cURL 400 badly formed request up vote -1 down vote favorite Windows NT DEV01 6.2 build 9200 (Unknown Windows version Standard Edition) i586 PHP Version 5.4.24 allow_url_fopen = On The url I'm using looks like this: http://stackoverflow.com/questions/32416348/curl-400-badly-formed-request http://www.warrantycompany.com/services/rate.asmx/GetRates?AccountNumber=37920N&DRFC=0&Mileage=52000&VIN=1G2ZA5EK3A4163364&ManufacturerWarranty=y&BrandedOrSalvaged=branded&EngineCC=0 And the relevant PHP code looks like this: $curlSession = curl_init(); curl_setopt($curlSession, CURLOPT_TIMEOUT , 30); curl_setopt($curlSession, CURLOPT_HTTPGET, 1); curl_setopt($curlSession, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curlSession, CURLOPT_URL, $url); $sTemp = curl_exec($curlSession); echo curl_errno($curlSession); echo curl_error($curlSession); Loaded into a browser directly, I get a long block of XML with the information I want. Through cURL, however, I get "HTTP Error 400. The request is badly formed." If I change the URL to read http://www.warrantycompany.com/services/rate.asmx/GetRates/?AccountNumber=... (note the forward slash before the question mark) I get the same. If I change the URL to http://www.warrantycompany.com/services/rate.asmx/GetRates?AccountNumber%3D37920N%26DRFC%3D0%26... using urlencode() on the parameters, the request works, but the remote system errors out. file_get_contents returns "false". The only way this works - and has worked to date - is to use the server object "MSXML2.ServerXMLHTTP", which I'd like to not if possible, but I'm at a loss. php curl share|improve this question edited Sep 6 '15 at 0:25 asked Sep 5 '15 at 18:24 Bill in Kansas City 34119
for Help Receive Real-Time Help Create a Freelance Project Hire for a Full Time Job Ways to https://www.experts-exchange.com/questions/27605053/Problems-With-CURL-and-PHP-returning-error-Bad-Request-Invalid-URL.html Get Help Ask a Question Ask for Help Receive Real-Time Help Create a Freelance Project Hire for a Full Time Job Ways to Get http://queforum.com/php/166447-php-http-error-400-request-badly-formed.html Help Expand Search Submit Close Search Login Join Today Products BackProducts Gigs Live Careers Vendor Services Groups Website Testing Store Headlines Experts Exchange http error > Questions > Problems With CURL and PHP returning error: Bad Request (Invalid URL) Want to Advertise Here? Solved Problems With CURL and PHP returning error: Bad Request (Invalid URL) Posted on 2012-02-26 PHP 1 Verified Solution 4 Comments 5,843 Views Last Modified: 2012-06-27 I am having http error 400 issues posting an XML string to a HTTP server. If I use the following code: I get the following data response: Bad Request - Invalid URL HTTP Error 400. The request URL is invalid. My XML output is exactly how the API Requires it. Could there issues using CURL to send to ASPX pages ? Thanks in advance $MUID="AAAA"; $MPWD="BBB"; //Parameters $ProjectID = "63"; $ClientID = "204"; $CampaignId = "529"; $RecipientMobileNumber = "88821111669"; $RecipientFirstName = "GGG"; $RecipientLastName = "RRR"; $RecipientEmail = "greg@dRRR9.com"; $UserId = "13"; $DealId = "3"; $DealRef = "13X3X323409827758"; $url = "http://api.****/request.aspx"; $post_string = ""."
- HTTP Error 400. The request is badly formed LinkBack LinkBack URL About LinkBacks Bookmark & Share Digg this Thread!Add Thread to del.icio.usBookmark in TechnoratiTweet this thread Thread Tools Show Printable Version Email this Page… Subscribe to this Thread… Display Linear Mode Switch to Hybrid Mode Switch to Threaded Mode 09-08-2013,04:30 PM #1 bigdata Senior Member Join Date Mar 2013 Posts 416,482 Php - HTTP Error 400. The request is badly formed I am getting the same error for this, please suggest $url="http://domain.com/manage/File Name.xml";$ch = curl_init();curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_URL, $url); // get the url contents$data = curl_exec($ch); // execute curl requestcurl_close($ch);echo $data; Check Solution Share Share this post on Digg Del.icio.us Technorati Twitter Reply With Quote « Previous Thread | Next Thread » Similar Threads Php - Minify throw http 400 error By bigdata in forum PHP Replies: 0 Last Post: 08-16-2013, 07:31 PM AFNetworking PUT request Error 400 By bigdata in forum Iphone Issues Replies: 0 Last Post: 08-10-2013, 02:40 PM Android-Http Request Status 400 By bigdata in forum Android Applications Replies: 0 Last Post: 05-10-2013, 03:50 PM Bind process error code-400 bad-request By bigdata in forum Iphone Issues Replies: 0 Last Post: 05-07-2013, 09:50 AM failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request By bigdata in forum Facebook Applications Replies: 0 Last Post: 04-19-2013, 06:20 PM Bookmarks Bookmarks Digg del.icio.us StumbleUpon Google Posting Permissions You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On [VIDEO] code is On HTML code is Off Trackbacks are On Pingbacks are On Refbacks are On Forum Rules -- Default Style -- Default Mobile Style QueForum Archive Top All times are GMT. The time now is 12:24 AM. cpp tutorials | Powered by vBulletin Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved. Content Relevant URLs by vBSEO 3.6.0 PL2