Home > Backend Development > PHP Tutorial > Curl error: couldn't connect to host

Curl error: couldn't connect to host

WBOY
Release: 2016-06-06 20:49:26
Original
1540 people have browsed it

通过php的curlpost数据到服务器,但是偶尔会出现Curl error: couldn't connect to host,怎么破?

回复内容:

通过php的curlpost数据到服务器,但是偶尔会出现Curl error: couldn't connect to host,怎么破?

你运行curl的机器和你curl的服务器之间的网络连接不是永远是好的,一般来说要保证服务质量你不能简单地curl。

你可以试试在try ctach里面curl,然后捕获常见的网络连接异常加超时并重试的机制。超时*重试次数完毕仍然连不上就把错误信息记录下来供分析或者是自动邮件提醒。

Related labels:
php
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template