You are not logged in.

#1 2012-10-15 06:35:00

ytsejam
Member
Registered: 2012-02-10
Posts: 56

curl -X POST gives "could not resolve host" error.

Hello ,
I am using LAMP server on arch linux. I try to use laravel php framework.

curl -X POST http://lbc.dev/api/category -H "Content-Type: application/json" –d '{"code":"cat1", "name":"Category One"}'

returns :

<pre>NULL
</pre>curl: (6) Could not resolve host: –d; Name or service not known

[1/2]: "code":"cat1" --> <stdout>
--_curl_--"code":"cat1"
curl: (6) Could not resolve host: "code"; Name or service not known

[2/2]:  "name":"Category One" --> <stdout>
--_curl_-- "name":"Category One"
curl: (6) Could not resolve host:  "name"; Name or service not known

my /etc/hosts is like here

#<ip-address>   <hostname.domain.org>   <hostname>
127.0.0.1       localhost.localdomain   localhost ytsejam
127.0.0.1       wlog.dev
127.0.0.1       lbc.dev                 localhost 
127.0.0.2       karayel
::1             localhost.localdomain   localhost

this is my vhost configuration :

<VirtualHost *:80>
  DocumentRoot "/home/ytsejam/public_html/lbc/public"
  ServerName lbc.dev
</VirtualHost>

What must be done to make curl work for vhost?

Offline

#2 2012-10-17 08:20:36

axs
Member
Registered: 2009-01-23
Posts: 71
Website

Re: curl -X POST gives "could not resolve host" error.

You have U2013 "en dash" in front of d, not U002D "hyphen-minus".
curl rightfully tries to interpret it as a domain name, an IDN to boot.

Offline

Board footer

Powered by FluxBB