php webservices code error

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
venkatesh.svs
Forum Newbie
Posts: 12
Joined: Wed Jan 06, 2010 1:30 am

php webservices code error

Post 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?
Daniel03155
Forum Newbie
Posts: 3
Joined: Sat Nov 07, 2009 9:06 pm

Re: php webservices code error

Post by Daniel03155 »

Do you even know php?
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: php webservices code error

Post by requinix »

Daniel03155 wrote:Do you even know php?
Do you?


venkatesh: are you running PHP 4? You need PHP 5.
venkatesh.svs
Forum Newbie
Posts: 12
Joined: Wed Jan 06, 2010 1:30 am

Re: php webservices code error

Post by venkatesh.svs »

we are running php 5.2.9 on wamp server
User avatar
JNettles
Forum Contributor
Posts: 228
Joined: Mon Oct 05, 2009 4:09 pm

Re: php webservices code error

Post by JNettles »

Which line is actually generating the error? Is the error on this page or is it being generated somewhere else?
Daniel03155
Forum Newbie
Posts: 3
Joined: Sat Nov 07, 2009 9:06 pm

Re: php webservices code error

Post 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.
User avatar
AbraCadaver
DevNet Master
Posts: 2572
Joined: Mon Feb 24, 2003 10:12 am
Location: The Republic of Texas
Contact:

Re: php webservices code error

Post 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;
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
Post Reply