Hi all,

Ok I cant figure something out. I have this code:

$vars = array('user'=>'demo',
              'password'=>'demo',
              'skey'=>'abc123',
              'request'=>'Dashboard',
              'userID'=>'2');
              
$data = apiGetD($vars);

function apiGetD($vars) {   
        $accessURL = 'www.eve-tool.com';
        $apiURL = '/api/class/class.access.php';
        $poststring = http_build_query($vars);
        $fp = fsockopen($accessURL, 80);

        fputs($fp, "POST " . $apiURL . " HTTP/1.0\r\n");
        fputs($fp, "Host: " .  $accessURL . "\r\n");
        fputs($fp, "Content-Type: application/x-www-form-urlencoded\r\n");
        fputs($fp, "User-Agent: PHPApi\r\n");
        fputs($fp, "Content-Length: " . strlen($poststring) . "\r\n");
        fputs($fp, "Connection: close\r\n\r\n");

        if (strlen($poststring) > 0)
            fputs($fp, $poststring . "\r\n");

        $contents = "";
        while (!feof($fp)) {
            $contents .= fgets($fp);
        }
        fclose($fp);
        $start = strpos($contents, "\r\n\r\n");

        if ($start !== false) {
            return substr($contents, $start + strlen("\r\n\r\n"));

        }
    }
    
    print_r($data);

Which is meant to connect to a class on another server and return an array. When I run it in a standalone "test.php" file on the same server as my drupal installation it works perfectly and I get the correct return.

If I then take that exact same code and insert it into a drupal block with the php filter on, it doesnt seem to be sending the "skey" variable and I get this pre-programmed error array back:

Array ( [0] => Array ( [message] => Authorization fail. [user] => demo [request] => [IP] => 74.208.43.153 [stamp] => 1232445084 ) [1] => Array ( [message] => No siteKey found. [user] => demo [request] => [IP] => 74.208.43.153 [stamp] => 1232445084 ) )

Note the "No siteKey found" error. Does anyone have any idea what might be messing this up, is there something in drupal that would interfere with this code? Or a way around it that I could try?

Cheers,

Tom