Forum Moderators: coopster

Message Too Old, No Replies

Please Help syntax error, unexpected T VARIABLE

I am getting a syntax error, unexpected T_VARIABLE.

         

geniuscapri

4:44 pm on Jun 1, 2011 (gmt 0)

10+ Year Member



Hi,
I am working with bigcommerce api. they give the example code to get the data.
I try to use that example script. But its giving a syntax error, unexpected T_VARIABLE. Please help me where this error. Below is code.

Parse error: syntax error, unexpected T_VARIABLE in /home/backbone/public_html/index.php on line 17

Thanks in advance.


<?php
$storeURL='https://store-bfe3e.mybigcommerce.com/xml.php';
$storeUser='admin';
$storeToken='fea22d5a541d8ed87e002eea7659a76243230ea7';
$xml='<xmlrequest>
<username>'.$storeUser.'</username>
<usertoken>'.$storeToken.'</usertoken>
<requesttype>orders</requesttype>
<requestmethod>GetOrder</requestmethod>
<details>
<orderId>1</orderId>
</details>
</xmlrequest>';
$ch = curl_init($storeURL);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 60);
curl_setopt($ch, CURLOPT_POSTFIELDS, $xml);
echo '<pre>';
echo htmlspecialchars(curl_exec($ch));
echo '</pre>';
curl_close($ch);

?>

Matthew1980

6:25 pm on Jun 1, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hello geniuscapri,

Is this the complete index file? I can't see anything wrong with this code; but I would suggest using double quotes on the echo's so that you can properly concatenate the variables into the string to be echoed.

Cheers,
MRb

agent_x

9:18 pm on Jun 1, 2011 (gmt 0)

10+ Year Member



Sometimes PHP can give errors that don't seem to make sense when there is something wrong elsewhere in the script. It might be getting confused by the line where you're defining $xml, try replacing the actual line breaks with \n and put it all on one line.