2016-07-28 48 views
0

似乎卷曲在我的本地主机上工作,但是当我将它上传到我的服务器时,它停止工作。我上传到我的服务器后,PHP卷曲不起作用

这是当我有它在localhost: enter image description here 这是主机提供商的服务器上: enter image description here

我不是一个专业的开发人员,但我认为有可能是一个问题主机提供商one.com

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

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



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

    Kint::dump($json['servers']); 
    foreach ($json['servers'] as $js){ 
     echo $js['name'] . ' is ' . ping($js['ip']) . ' <br>'; 
    } 
?> 
+1

是否在主机上安装了php curl模块? – Jaime

+0

检查卷曲模块是否安装并支持,看看是否是这个问题http://stackoverflow.com/questions/13433946/how-to-check-if-curl-is-enabled-or-disabled – robobobobo

+0

它说它是安装,看看这个链接http://hazar.se/sv/ –

回答

0

我想我找到了问题,它似乎在c9.io工作,所以它的东西做的Wi今天我只会购买真正的服务器而不是廉价的主机提供商。

+0

One.com支持:迈克尔:是cURL支持,但请注意,如果还有其他除端口80和443(用于https/ssl)外,我们的防火墙很可能会阻止它。 –