CURL传递value = null

时间:2013-12-04 08:05:23

标签: php curl

下面是我使用cURL将变量传递给另一台服务器的一段代码。虽然与其他服务器有联系,但显示传递的变量 username = null等。如果真的很感激你的建议。提前致谢

  1. if(!isset($_COOKIE['admin'])){
    
        include_once("login.php");
    
        echo ("<div id='quote'>Error: Can not access page.");   }
    
    else {       if (isset($_GET['user']) && ($_GET['user'] != "") &&
    isset($_GET['pass']) && ($_GET['pass']  != "") && isset($_GET['to'])
    && ($_GET['to'] != "") && ($_GET['username'] != "")) {
    
                        $username = $_GET["username"]; 
    
            $idlicenza= $_GET["user"];
    
            $licence = $_GET["pass"];
    
                        $to = $_GET["to"];
                        $acc = new Account;
    
                        $acc->changeVis($idlicenza, $licence, $to);             header("Location: search.php?user=".$username); 
    
    
    
    
                    $ch = curl_init();
    
                curl_setopt($ch, CURLOPT_URL,"http://xxxx/add-user");
    
                curl_setopt($ch, CURLOPT_POST, 1);
    
                curl_setopt($ch, CURLOPT_POSTFIELDS,
                                          "username=userId&idliscence=codes&myid=password");
    
                    // receive server response ...
    
                curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    
                $server_output = curl_exec ($ch);
    
                print_r($server_output);
    
                curl_close ($ch);
                        }    } ?>
    

0 个答案:

没有答案