我可以使用lynx从服务器访问网站没有问题。但是当我尝试使用php curl指令访问同一个网站时,从curl_getinfo($ch)得到的http_code是0。
在同一个数据中心的另一台红帽服务器上,相同的php代码可以正常工作。我对服务器有管理员权限。
我尝试过php 7.4和php 8.0。 当我调用phpinfo()时,curl是启用的。 我不确定如何调试这个错误!
这是curl_getinfo($ch)的输出。
数组([url] => https://.... [content_type] => [http_code] => 0 [header_size] => 0 [request_size] => 0 [filetime] => -1 [ssl_verify_result] => 0 [redirect_count] => 0 [total_time] => 0.055895 [namelookup_time] => 0.105978 [connect_time] => 0 [pretransfer_time] => 0 [size_upload] => 0 [size_download] => 0 [speed_download] => 0 [speed_upload] => 0 [download_content_length] => -1 [upload_content_length] => -1 [starttransfer_time] => 0 [redirect_time] => 0 [redirect_url] => [primary_ip] => [certinfo] => Array() [primary_port] => 0 [local_ip] => [local_port] => 0 [http_version] => 0 [protocol] => 0 [ssl_verifyresult] => 0 [scheme] => [appconnect_time_us] => 0 [connect_time_us] => 0 [namelookup_time_us] => 105978 [pretransfer_time_us] => 0 [redirect_time_us] => 0 [starttransfer_time_us] => 0 [total_time_us] => 55895)
在同一个数据中心的另一台红帽服务器上,相同的php代码可以正常工作。我对服务器有管理员权限。
我尝试过php 7.4和php 8.0。 当我调用phpinfo()时,curl是启用的。 我不确定如何调试这个错误!
这是curl_getinfo($ch)的输出。
数组([url] => https://.... [content_type] => [http_code] => 0 [header_size] => 0 [request_size] => 0 [filetime] => -1 [ssl_verify_result] => 0 [redirect_count] => 0 [total_time] => 0.055895 [namelookup_time] => 0.105978 [connect_time] => 0 [pretransfer_time] => 0 [size_upload] => 0 [size_download] => 0 [speed_download] => 0 [speed_upload] => 0 [download_content_length] => -1 [upload_content_length] => -1 [starttransfer_time] => 0 [redirect_time] => 0 [redirect_url] => [primary_ip] => [certinfo] => Array() [primary_port] => 0 [local_ip] => [local_port] => 0 [http_version] => 0 [protocol] => 0 [ssl_verifyresult] => 0 [scheme] => [appconnect_time_us] => 0 [connect_time_us] => 0 [namelookup_time_us] => 105978 [pretransfer_time_us] => 0 [redirect_time_us] => 0 [starttransfer_time_us] => 0 [total_time_us] => 55895)