I am having problem using the HTTP_POST_RAW_DATA variable, and perhaps someone maybe able to help me out

I am trying to test this nuSOAP application- originally based on a tutorial on Zend. But, I am unable to send any information from the SOAP server. Here's the code for SOAP server:

PHP:

<?php_

require_once('nusoap.php');_

$server=new_soap_server;

$server->register('taxCalc');_

function_taxCalc($rate,$sub){_

_____if($rate==''||$rate<=0){_


_______return_soap_fault('Client','','Must supply positive non zero tax rate, ','');



_______}


______if($sub==''||$sub<=0){


________return_soap_fault('Client','','Must supply a positive non zero tax rate, ','');_


________}


_______return(($rate/100)*$sub)+$sub;


____}


$server->service($SERVER['HTTP_RAW_POST_DATA']);

exit();

?>
____

and the SOAP client

PHP:

<?_

require_once('nusoap.php');_

$param=array('rate'=>$GET['rate'],'sub'=>$GET['sub']);_

$client=new_soapclient('http://localhost/taxCalc.php');_

$response=$client->call('taxCalc',$param);

if($client->fault){

echo"FAULT: <p>Code:{$client->faultcode}<br/>";
echo"string:{$client->faultstring}";

}else{

echo"$".$response;


__}_

?>_

The $response variable is unable to receive any information. How can I make sure that the HTTP_RAW_POST_DATA is functional on PHP 4.2, running on Mac OS X.

Many thanks in advance.

    I don't know the answer to your problem but when you post php code try to put it between php formatting tags. There is a button right above the textarea for the post message labled "PHP". This way it will indent the code so you don't have to use ____. It also colors it nicely. Just as a FYI.

    Ex:

    <?php
    echo "Hi";
    //Comment area
    ?>
    
      3 months later

      Hanoud,

      Look in your php.ini file, there is an option there that you have to turn on to get $HTTP_RAW_POST_DATA to be populated.

      I don't know where it'd be installed on you Mac OSX, but if run phpinfo() it will show you.

        6 months later

        I was using the same example and I solved my problem by changing the following line:

        $server->service($HTTP_RAW_POST_DATA)

        To:

        $server->service($GLOBALS['HTTP_RAW_POST_DATA'])

        Hope this helps.

          Write a Reply...