Forum Moderators: coopster

Message Too Old, No Replies

Need help with T_CONSTANT_ENCAPSED_STRING

unexpected T_CONSTANT_ENCAPSED_STRING

         

porterl

3:11 pm on May 8, 2005 (gmt 0)

10+ Year Member



Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ')' in /home/brooking/public_html/bibleVerse/verse.php on line 33

nusoap.php and verse.php are in the same directory.

Thanks in advance for your assistance!

PAGE CODE is below (line 33 is bold: 'include-audio-link'=>'1')

-------------------------------------------------------------------------

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Daily Bible Verse</title>
</head>

<body>
<?php
/**
* Display Bible Gateway Verse of the Day.
*/

/* display SOAP errors */
function showErrors( $soapclient, $results ) {
echo 'Request: <xmp>'.$soapclient->request.'</xmp>';
echo 'Response: <xmp>'.$soapclient->response.'</xmp>';
echo 'Debug log: <pre>'.$soapclient->debug_str.'</pre>';
echo $results['faultstring'];
}

/* load NuSOAP library */
require_once('nusoap.php');

/* create new soap client */
$soapclient = new soapclient('http://www.example.com/usage/votd/');

/* set parameter values */
$parameters= array('preferences'=>array('version_id'=>'31',
'utc_offset'=>'-5'),
'options'=>array('include-copyright'=>'both',
'include-url-link'=>'1',
'include-audio-link'=>'1'
)
);

/* call service and get verse of the day */
$results = $soapclient->call('doGetVotd',$parameters);

/* display verse of the day */
if($err = $soapclient->getError()){
showErrors($soapclient, $results);
} else {
print $results;
}

?>

</body>
</html>

[edited by: jatar_k at 12:47 am (utc) on May 9, 2005]
[edit reason] generalized url [/edit]

Deester

3:51 pm on May 8, 2005 (gmt 0)

10+ Year Member



Hi,

Your problem is actually on this line

if($err = $soapclient->getError()){

You are using a single = sign which as you know is for variable assignment and not for testing a certain condition which the == does. Add the extra equals and it should work.

Also, the line I've highlighted is actually line 33 of the PHP code. PHP will report the line number in the actual script and not include the HTML.

Deester

porterl

6:16 pm on May 8, 2005 (gmt 0)

10+ Year Member



I continue to get the same error after making the change you suggested.

ERROR
Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ')' in /home/brooking/public_html/bibleVerse/verse.php on line 33

PAGE CODE

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Daily Bible Verse</title>
</head>

<body>
<?php
/**
* Display Bible Gateway Verse of the Day.
*/

/* display SOAP errors */
function showErrors( $soapclient, $results ) {
echo 'Request: <xmp>'.$soapclient->request.'</xmp>';
echo 'Response: <xmp>'.$soapclient->response.'</xmp>';
echo 'Debug log: <pre>'.$soapclient->debug_str.'</pre>';
echo $results['faultstring'];
}

/* load NuSOAP library */
require_once('nusoap.php');

/* create new soap client */
$soapclient = new soapclient('http://www.example.com/usage/votd/');

/* set parameter values */
$parameters= array('preferences'=>array('version_id'=>'31',
'utc_offset'=>'-5'),
'options'=>array('include-copyright'=>'both',
'include-url-link'=>'1',
'include-audio-link'=>'1'
)
);

/* call service and get verse of the day */
$results = $soapclient->call('doGetVotd',$parameters);

/* display verse of the day */
if($err == $soapclient->getError()){
showErrors($soapclient, $results);
} else {
print $results;
}

?>

</body>
</html>

[edited by: jatar_k at 12:48 am (utc) on May 9, 2005]
[edit reason] generalized url [/edit]

coopster

2:14 am on May 11, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld, porterl.

The syntax looks fine here. Is there something in the class causing issues?