I had a web service with nusoap library and nusoap work fine on php 5.3 and 5.5, but at the moment i am working on php 5.6 and encountered to following error when using nusoap library:
Automatically populating $HTTP_RAW_POST_DATA is deprecated and will be removed in a future version. To avoid this warning set 'always_populate_raw_post_data' to '-1' in php.ini and use the php://input stream instead. in Unknown on line 0
I researched to much about this issue and did not success.
I tried to find compatible version of nusoap with php 5.6 but could not find any solution and finally decided to use SoapServer and SoapClient and tested with following code:
<?php
class MyAPI {
function hello() {
return "Hello";
}
}
$options=array('uri'=>'http://xx.com:800/webservice/');
$server = new SoapServer(NULL,$options);
$server->setClass('MyAPI');
$server->handle();
?>
and following as client file:
<?php
$options = array('location' => 'http://xx.com:800/webservice/server.php',
'uri' => 'http://xx.com:800/webservice/');
$api = new SoapClient(NULL, $options);
echo $api->hello();
?>
but when i call client file i encounter to following error:
Fatal error: Uncaught SoapFault exception: [Client] looks like we got no XML document in PATH\webservice\client.php:11 Stack trace: #0 PATH\webservice\client.php(11): SoapClient->__call('hello', Array) #1 PATH\webservice\client.php(11): SoapClient->hello() #2 {main} thrown in PATH\webservice\client.php on line 11
can you give me good and best solutions?
$HTTP_POST_RAW_DATA is deprecated in PHP 5.6 You got to use file_get_contents("php://input");