Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个抓取不同网站的 php curl 脚本。问题是,过了一会儿,我认为网站对我的 IP 设置了一种临时禁令,并且脚本无法再连接到主机(因为我收到“无法连接到主机”错误)。我想设置一个条件/函数来使脚本停止一段时间(例如 sleep(30)),但我不知道当 cURL 无法连接到主机时如何检测(处理错误)。
php.net/curl_errno