Error while writing a web service in php -


i wrote simple webservice in php on linux machine. here code:
service.php

<?php     require 'lib/nusoap.php';     include 'functions.php';     $server=new nusoap_server();     $server->configurewsdl("demo"."urn:demo");     $server->register(         "price", //name of function         array("name"=>'xsd:string'), //inputs         array("return"=>'xsd:inter')  //outputs     );     http_raw_post_data = isset($http_raw_post_data) ? $http_raw_post_data : '';     $server->service($http_raw_post_data); ?>   

functions.php

<?php  function price($name){     $details=>array(         'abc'=>123,         'qwe'=>34        );     foreach ($details $n => $p) {         if ($name==$n) {             $price=$p;         }     }     return $price; }  /*function countname(){  }*/  ?>   

but got error this:

[wed jul 15 00:10:54.675740 2015] [:error] [pid 1564] [client 127.0.0.1:40356] php parse error: syntax error, unexpected '=' in /var/www/html/phpwebservice/service.php on line 11

i'm unable understand error. how can fix it?

the problem line:

http_raw_post_data = isset($http_raw_post_data) ? $http_raw_post_data : ''; 

to php looks you're trying assign constant. either add $ make variable, or use define() create constant value.


Comments