Take the 2-minute tour ×

The error the following code give is

HTTP/1.0 400 Bad Request: Invalid HTTP Version in Request Line. Line: GET /http/send-message?to=233445566&message=Some String

    $curl = curl_init();
            CURLOPT_HEADER => 1,
            CURLOPT_TIMEOUT => 4,
            CURLOPT_VERBOSE => 1,
                    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
                    CURLOPT_URL => 'http://GATEWAY:9710/http/send-message?to='.$mobileNumber.'&message='.$message


Let me know what is going on?

share|improve this question
I can't tell from what you posted but are you urlencoding the $message? –  noko Jan 21 '13 at 6:52
Set the version to CURL_HTTP_VERSION_1_0 and try again. –  Ja͢ck Jan 21 '13 at 6:54
@Jack,i tried it did not work. –  BinCode Jan 21 '13 at 9:21
@noko, URL Ecoding did the trick, :) THanks buddy –  BinCode Jan 21 '13 at 9:23

1 Answer 1

That's not cURL, that's how HTTP works - the domain portion of the URL is passed in the Host: header, not the request. The request itself starts at the first / after the domain.

The error you're getting back appears to be due to the fact that you're explicitly setting HTTP 1.1, and the server is a 1.0 server.

Edit: Looks like your problem was solved in the comments above. In general, urlencoding things you're going to put in a URL is useful. :)

share|improve this answer
I tried chnaging HTTP 1.1 to 1.0 , it did not work still :( –  BinCode Jan 21 '13 at 9:20

Your Answer


