【问题标题】:cURL not working卷曲不工作
【发布时间】:2013-08-06 23:49:55
【问题描述】:

我在使用 php cURL 脚本时遇到了一些问题。它在我的本地主机上运行良好,但在我的服务器上不起作用。我的服务器可以成功执行除此之外的其他 curl 脚本。 这是来自我的服务器的print_r(curl_getinfo($ch)); 的结果:

Array ( [url] => http://xx.xx.xx.xx:8080/bulksms/bulksms 
        [content_type] => 
        [http_code] => 0 
        [header_size] => 0 
        [request_size] => 0 
        [filetime] => -1 
        [ssl_verify_result] => 0 
        [redirect_count] => 0 
        [total_time] => 15.00012 
        [namelookup_time] => 0.000145 
        [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 
        [certinfo] => Array ( ) 
        [primary_ip] => xx.xx.xx.xx 
        [primary_port] => 8080 
        [local_ip] => 
        [local_port] => 0 
        [redirect_url] => )

这是来自我的本地主机的print_r(curl_getinfo($ch)); 的结果:

Array ( [url] => http://xx.xx.xx.xx:8080/bulksms/bulksms 
        [content_type] => text/html;charset=UTF-8 
        [http_code] => 200 
        [header_size] => 141 
        [request_size] => 178 
        [filetime] => -1 
        [ssl_verify_result] => 0 
        [redirect_count] => 0 
        [total_time] => 0.89 
        [namelookup_time] => 0 
        [connect_time] => 0 
        [pretransfer_time] => 0 
        [size_upload] => 0 
        [size_download] => 4 
        [speed_download] => 4 
        [speed_upload] => 0 
        [download_content_length] => 4 
        [upload_content_length] => 0 
        [starttransfer_time] => 0.89 
        [redirect_time] => 0 
        [certinfo] => Array ( ) 
        [primary_ip] => xx.xx.xx.xx 
        [primary_port] => 8080 
        [local_ip] => 127.0.0.1 
        [local_port] => 3925 
        [redirect_url] => )

可能是什么原因,我该如何解决?

【问题讨论】:

  • curl_error($ch) 说什么?
  • 据我所知,这些 curl_getinfo 之间的区别是:[local_ip] 未在您的实时服务器上设置,无法正常工作。
  • @anq : curl_error($ch);不返回任何错误。它显示一个空白页。

标签: php curl


【解决方案1】:

8080 端口被您的托管服务提供商阻止。共享主机尤其如此

【讨论】:

  • 这行得通。我必须在服务器防火墙上打开端口 8080。谢谢! :)
猜你喜欢
  • 2018-06-07
  • 2019-10-01
  • 1970-01-01
  • 1970-01-01
  • 2023-03-29
  • 1970-01-01
  • 1970-01-01
  • 2012-04-08
  • 2023-03-19
相关资源
最近更新 更多