curl: no URL specified

20,444

I think on Windows you need to use double quotes to quote arguments, not single quotes. As a result, the command is ending after http://google.com, everything after that is being treated as a new command, starting with description.

$ curl -i --user firstuser:first_password -d "url=http://google.com&description=A Search Engine" localhost/laravel-1/public/index.php/api/v1/url

The examples in the tutorial you copied from were run on Unix, not Windows. It uses both double and single quotes to quote arguments.

Share:
20,444
Admin
Author by

Admin

Updated on December 19, 2020

Comments

  • Admin
    Admin over 3 years

    I trying to learn Laravel 4: A Start at a RESTful API

    I am in half way already, then I face one little problem.

    I am stuck at It's time to test this with another curl request. This one will send a POST request, which will correspond to the store() method created above.

    I ran this command

    $ curl -i --user firstuser:first_password -d 'url=http://google.com&description=A Search Engine' localhost/laravel-1/public/index.php/api/v1/url
    

    I should see sth like this

    HTTP/1.1 201 Created
    Date: Tue, 21 May 2013 19:10:52 GMT
    Content-Type: application/json
    
    {"error":false,"message":"URL created"}
    

    But I see this instead :(

    enter image description here

    Is the url is no longer valid ? OR did I do anything wrong ?

  • Admin
    Admin over 9 years
    I tried that, but I face the same messade. See here
  • Barmar
    Barmar over 9 years
    Could you paste text into the question instead of a screenshot? Use the {} code tool to mark it as verbatim code.
  • Admin
    Admin over 9 years
    C:\wamp\www\laravel-1 λ curl --user seconduser:second_password -d 'url=http://digitalsurgeons.com&description=A Marketing Agency' localhost/laravel-1/pu blic/index.php/api/v1/url curl: no URL specified! curl: try 'curl --help' or 'curl --manual' for more information 'description' is not recognized as an internal or external command, operable program or batch file.
  • Barmar
    Barmar over 9 years
    I think the problem is your quoting around the -d parameter.
  • Admin
    Admin over 9 years
    No, I didn't quoting around the -d parameter
  • Barmar
    Barmar over 9 years
    I still don't understand what you're saying. Your question clearly shows single quotes around url=http://google.com&description=A Search Engine. You need to use double quotes instead of single quotes.
  • Admin
    Admin over 9 years
    Ohh ok. I got what you're saying now.
  • Admin
    Admin over 9 years
    But how's come, I didn't get any feedback like him, HTTP/1.1 201 Created Date: Tue, 21 May 2013 19:10:52 GMT Content-Type: application/json {"error":false,"message":"URL created"}
  • Barmar
    Barmar over 9 years
    I don't know. Does your webserver log show that the request is being processed?
  • Admin
    Admin over 9 years
  • Yar
    Yar about 9 years
    yes this is a problem(?) in Windows. for instance you won't get response for this query: curl -i -X POST --data 'field1=123&field2=value 2' 'http://localhost:3000' but instead it is fine with this syntax: curl -i -X POST --data "field1=123&field2=value 2" "http://localhost:3000"
  • Barmar
    Barmar about 9 years
    If this answer solved your problem, please accept it. Click the check mark next to the answer.