curl: no URL specified
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.
Admin
Updated on December 19, 2020Comments
-
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 :(
Is the url is no longer valid ? OR did I do anything wrong ?
-
Admin over 9 yearsI tried that, but I face the same messade. See here
-
Barmar over 9 yearsCould you paste text into the question instead of a screenshot? Use the
{}
code tool to mark it as verbatim code. -
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 over 9 yearsI think the problem is your quoting around the
-d
parameter. -
Admin over 9 yearsNo, I didn't quoting around the
-d
parameter -
Barmar over 9 yearsI 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 over 9 yearsOhh ok. I got what you're saying now.
-
Admin over 9 yearsBut 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 over 9 yearsI don't know. Does your webserver log show that the request is being processed?
-
Admin over 9 yearsLet us continue this discussion in chat.
-
Yar about 9 yearsyes 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 about 9 yearsIf this answer solved your problem, please accept it. Click the check mark next to the answer.