Page 1 of 1

php webservices code error

Posted: Wed Jan 06, 2010 1:43 am
by venkatesh.svs
this is the php code i'm running on the server

<?php
require_once('lib/nusoap.php');

$request = "http://www.webserviceX.NET/GetWeather";
$location = "http://www.webservicex.net/globalweather.asmx";
$action = "tns:GetWeatherSoapIn";
//$version = "5.0.1";

$version = "0.7.3";


class mySoap extends SoapClient
{
public function __doRequest($request, $location, $action, $version)
{
$result = parent::__doRequest($request, $location, $action, $version);
//$result = str_replace('<key xsi:type="xsd:int">', '<key xsi:type="xsd:string">', $result);
return $result;
}
}

//$abc = new mySoap(
$res = __doRequest($request, $location, $action, $version);
echo "<br/>weather report info :<br/>".$res;
?>

This is the error :

Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in C:\Inetpub\vhosts\myw3portal.com\httpdocs\weatherreport.php on line 14


can someone resolve my problem?

Re: php webservices code error

Posted: Wed Jan 06, 2010 2:37 am
by Daniel03155
Do you even know php?

Re: php webservices code error

Posted: Wed Jan 06, 2010 4:02 am
by requinix
Daniel03155 wrote:Do you even know php?
Do you?


venkatesh: are you running PHP 4? You need PHP 5.

Re: php webservices code error

Posted: Wed Jan 06, 2010 5:56 am
by venkatesh.svs
we are running php 5.2.9 on wamp server

Re: php webservices code error

Posted: Wed Jan 06, 2010 9:49 am
by JNettles
Which line is actually generating the error? Is the error on this page or is it being generated somewhere else?

Re: php webservices code error

Posted: Wed Jan 06, 2010 12:57 pm
by Daniel03155
I asked because he was calling a method without instantiating the class first.
tasairis wrote:
Daniel03155 wrote:Do you even know php?
Do you?


venkatesh: are you running PHP 4? You need PHP 5.
Yes. What does php 4 have to do with it ? It's a syntax error. Probably he's not pasting the entire code, or the error is somewhere else like JNettles said.

Re: php webservices code error

Posted: Wed Jan 06, 2010 1:06 pm
by AbraCadaver
Daniel03155 wrote:I asked because he was calling a method without instantiating the class first.
tasairis wrote:
Daniel03155 wrote:Do you even know php?
Do you?


venkatesh: are you running PHP 4? You need PHP 5.
Yes. What does php 4 have to do with it ? It's a syntax error. Probably he's not pasting the entire code, or the error is somewhere else like JNettles said.
Because this error is generated because of the 'public' keyword on line 14 which doesn't exist in PHP < 5.

venkatesh.svs

Code: Select all

echo PHP_VERSION;