Curl could not resolve host



проблема с curl: Couldn’t resolve host

Добрый день!
Есть небольшой класс(connect.class.php):
вот его часть имеющая отношение с curl

pages передаются из textarea стартовой формы. пишем туда адреса страниц, каждый на новой строчке.

Проблема заключается в следующем: почему-то открывается всегда, только последний введенный адрес,например:
ввожу в textarea:

never knows best



*и страница гугла внизу.

(((( вродеб адреса нормальные. слип поставил. а он все равно не конектится.

never knows best




TeaM PHPClub



с днс все нормально, в чем легко убедиться, поменяв местами урл. допустим так:

в ответ получаем:
Couldn’t resolve host ‘ ‘
Couldn’t resolve host ‘’

и страницу яндекса ниже.
а curl_multi_exec так этож ток пхп 5 ((((
неужели задуманное мною невозможно осуществить на пхп4.
задача вродеб не сложная.
но решить её самостоятельно увы не могу((
ввиду отсутствия опыта работы с curl .

Getting url: (6) Could not resolve host: application error after this command :

Full error log:

What’s wrong with this command?


I solved my problem editing like this in windows : ""

5 Answers 5

In my case, putting space after colon was wrong.

It’s treating the string application as your URL.
This means your shell isn’t parsing the command correctly.
My guess is that you copied the string from somewhere, and that when you pasted it, you got some characters that looked like regular quotes, but weren’t.
Try retyping the command; you’ll only get valid characters from your keyboard. I bet you’ll get a much different result from what looks like the same query. As this is probably a shell problem and not a ‘curl’ problem (you didn’t build cURL yourself from source, did you?), it might be good to mention whether you’re on Linux/Windows/etc.

Example for Slack. (use your own web address you generate there).

curl -X POST -H "Content-type:application/json" —data "<"text":"A New Program Has Just Been Posted. ">"

I was getting this error too. I resolved it by installing:

and running the command from the Git Bash window.

I replaced all the single quotes [‘] to double quotes ["] and then it worked perfectly. Thanks for the input by @LogicalKip.

I try to run cocurrent curl but it can easily report "Could not resolve host". To run curl parallel, I use "parallel".

How could resolve host fail for just 4 concurrent curl? I simulate this because the original problem I encounter is described in php curl localhost is slow when making concurrent requests. I really don’t think it’s an open file limit issue since there is just 4 concurrent curl. Can anyone explain why this occurs? By the way, the OS is ubuntu 16.04.

[an error occurred while processing the directive]
Карта сайта