Curl: URL not specified

I'm trying to learn Laravel 4: Get started with the RESTful API

I'm already halfway, then I encounter one small problem.

I am stuck in It time to test this with another curl request. This one will send a POST request, which will correspond to the store() method created above. It 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 have to see it like

 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 more invalid? OR did I do something wrong?

+5
source share
1 answer

I think on Windows you need to use double quotes to quote arguments, not single quotes. As a result, the team ends after http://google.com , everything after that is processed as a new team, 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 that you copied were run on Unix, not Windows. It uses both double and single quotes to quote arguments.

+4
source

Source: https://habr.com/ru/post/1209472/


All Articles