我在托管服务(老爹)上做卷毛有问题

时间:2018-10-09 06:11:14

标签: php curl

我在连接服务器脚本时遇到问题。我有一个经济的Godaddy托管服务器,我用php写了一个脚本来连接到使用mavens扑克应用程序的游戏服务器。我在本地执行了所有操作,并且其工作正常,但是当我将代码放入Godaddy主机时,它无法连接,我认为我对Godaddy主机的卷曲有问题。我在php.ini中添加了extension = curl.so,但它也无法正常工作。

有我的脚本卷曲页面

    <?php

   $url = "http://37.61.213.122:8087/api"; 
  $pw = "aTWdehnxuIenpiFI";                    





  function Poker_API($params)
  {
    global $url, $pw;
    $params['Password'] = $pw;
    $params['JSON'] = 'Yes';
    $curl = curl_init($url);
    curl_setopt($curl, CURLOPT_POST, true);
    curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($params));
    curl_setopt($curl, CURLOPT_TIMEOUT, 30);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); 
    curl_setopt($curl, CURLOPT_VERBOSE, true);
    curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
    $response = curl_exec($curl);
    if (curl_errno($curl)) $obj = (object) array('Result' => 'Error', 'Error' => curl_error($curl)); 
    else if (empty($response)) $obj = (object) array('Result' => 'Error', 'Error' => 'Connection failed'); 
    else $obj = json_decode($response);
    curl_close($curl);
    return $obj;
  }

?>

还有一个我需要在服务器上为我做的功能

 <?php
 include('api.php') ;

    $username = $_SESSION['username'];


            function showBalance (){
                global $username;
     $params = array("Command" => "AccountsGet", "Player" => $username);
    $api = Poker_API($params);  
        echo $api-> Balance;    
            }


                        function showUsername (){
                global $username;
     $params = array("Command" => "AccountsGet", "Player" => $username);
    $api = Poker_API($params);  
        echo $api-> Player; 
            }


 function  showEmail (){
            global $username;
     $params = array("Command" => "AccountsGet", "Player" => $username);
    $api = Poker_API($params);  
        echo $api-> Email;  
 }

 function  showlastLogin (){
            global $username;
     $params = array("Command" => "AccountsGet", "Player" => $username);
    $api = Poker_API($params);  
        echo $api-> LastLogin;  
 }



 function doAccountsIncBalance ($amountinc) {
                global $username;
     $params = array("Command" => "AccountsIncBalance", "Player" => $username, "Amount" => $amountinc);
    $api = Poker_API($params);       
 }


  function doAccountsDecBalance ($amountinc) {
                global $username;
     $params = array("Command" => "AccountsDecBalance", "Player" => $username, "Amount" => $amountinc);
    $api = Poker_API($params);       
 }









?>

我不知道问题出在哪里,但是它在本地工作得很好

1 个答案:

答案 0 :(得分:0)

我已经测试了您的脚本,并且可以正常工作。然后,我进行了一些研究,从发现的内容来看,这似乎是Daddy托管问题。因此,您最好对它们进行纠正,并询问如何使脚本正常工作或找到更可靠的托管。