[英]How to get PHP error messages via CURL
I'm writing a PHP CLI testing tool for large Websites. 我正在为大型网站编写PHP CLI测试工具。 It checks the HTTP Response Code on Websites written in PHP.
它检查用PHP编写的网站上的HTTP响应代码。 The tool works with cURL.
该工具可与cURL一起使用。 But if i get not the expected status code (expected should be 200, but I get 500), I don't know why.
但是,如果我没有得到预期的状态代码(预期应该是200,但是我得到500),我不知道为什么。 Is there a possibility to get the occurred error on the website via curl to save it in an Report or something else?
是否有可能通过curl在网站上获取发生的错误以将其保存在报告或其他内容中?
在进行实际的cURL调用之前,请先尝试使用get_headers()。
What you are looking for is the function curl_getinfo(). 您正在寻找的是功能curl_getinfo()。 You can find the documentation here: http://www.php.net/manual/en/function.curl-getinfo.php
您可以在此处找到文档: http : //www.php.net/manual/zh/function.curl-getinfo.php
The procedure is as follows: 步骤如下:
Hope this helps! 希望这可以帮助!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.