[PHP] curl proxy returning NULL

Proximity

IDK?
Feb 13, 2014
673
56
Code:
function no_db_p($username, $password, $proxy, $port){
    logout($username, $password);
   
    sleep(5);
   
    $url = 'https://authserver.mojang.com/authenticate';
   
    $json = array();
   
    $json['agent']['name'] = "Minecraft";
    $json['agent']['version'] = 1;
   
    $json['username'] = "".$username;
    $json['password'] = "".$password;
   
    $json['clientToken'] = generateRandomString(32);
   
    $request = curl_init();
    curl_setopt($request, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($request, CURLOPT_PROXY, $proxy);
    curl_setopt($request, CURLOPT_PROXYPORT, $port);
    curl_setopt($request, CURLOPT_PROXYTYPE, CURLPROXY_HTTP);
    curl_setopt($request, CURLOPT_FOLLOWLOCATION, TRUE);
    curl_setopt($request, CURLOPT_USERAGENT, "MCAuth 1.3 (https://github.com/mattiabasone/MCAuth)");
    curl_setopt($request, CURLOPT_HTTPHEADER , array('Content-Type: application/json'));
    curl_setopt($request, CURLOPT_POST, TRUE);
    curl_setopt($request, CURLOPT_POSTFIELDS, json_encode($json));
    curl_setopt($request, CURLOPT_URL, $url);
    $ret = curl_exec($request);
    $x = curl_getinfo($request);
    curl_close($request);
   
    $returned = json_decode($ret);
    var_dump($returned);
    echo "\n\n";
   
    if($returned !== null){
        if(array_key_exists("errorMessage", $returned)){
            echo "x Incorrect!";
            return "false";
        }else{
            echo "x Correct!";
            $name = $returned->selectedProfile->name;
            return $name;
        }
    }else{
        echo "KAPUT";
    }
   
    sleep(1);
   
    logout($username, $password);
}

This was posted for my friend @LiteTeBoss as it wasn't letting him post.
 

Users who are viewing this thread

Top