2016-07-28 23:08
浏览 66

我将它上传到我的服务器后,Php curl不起作用

It seems that curl works on my localhost but when I upload it to my server it stops working.

This is when i have it on localhost : enter image description here And this is on the host provider server : enter image description here

I am not a professional developer but i think there can be a problem with the host provider

require 'kint/Kint.class.php';
$cURL = curl_init('');
curl_setopt($cURL, CURLOPT_PORT, 3000);
curl_setopt($cURL, CURLOPT_RETURNTRANSFER, true);

$jsondata = curl_exec($cURL);
$json = json_decode($jsondata, true);

function ping($host,$port=4000,$timeout=6)
        $fsock = fsockopen($host, $port, $errno, $errstr, $timeout);
        if ( ! $fsock )
            return 'Offline';
            return 'Online';

    foreach ($json['servers'] as $js){
        echo  $js['name'] . ' is ' . ping($js['ip']) . ' <br>';
  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • duanquan1243 2016-07-29 00:29

    I think I found the problem, it seems to work on so it's something to do with, in future I will only buy real servers instead of a cheap host provider.

    解决 无用
    打赏 举报

相关推荐 更多相似问题