Jump to content



Photo
- - - - -

Parse error: syntax error, unexpected T_STRING in /home/mtgman5/public_html/includes/modules/shipping/usps.php on line 1210

parse error

This topic has been archived. This means that you cannot reply to this topic.
4 replies to this topic

#1   MTG Mania

MTG Mania
  • Members
  • 55 posts

Posted 02 August 2012 - 16:47

Hiya Guys,

I am so sorry to keep bugging like this, I know it tends to get annoying. I did fix the other errors myself (had about 10 of them!) but this one, I don't know. Error comes up on line 1210. Here is from about 1190 and down.


$request .= '</IntlRateV2Request>';
$request = 'API=IntlRateV2&XML=' . urlencode($request);
$usps_server = 'production.shippingapis.com';
$api_dll = 'shippingAPI.dll';
$body = '';
if (!class_exists('httpClient')) {
include('includes/classes/http_client.php');
}
$http = new httpClient();
if ($http->Connect('production.shippingapis.com', 80)) {
$http->addHeader('Host', 'production.shippingapis.com);
$http->addHeader('User-Agent', 'osCommerce'); <--------------- This is line 2010
$http->addHeader('Connection', 'Close');
if ($http->Get('/shippingapi.dll?' . $request)) $body = $http->getBody();
$http->Disconnect();
} else {
$body = '<Error><Number></Number><Description>' . MODULE_SHIPPING_USPS_TEXT_CONNECTION_ERROR . '</Description></Error>';
}
$doc = XML_unserialize($body);
$quotes = array();
if (isset($doc['Error'])) return array('error' => $doc['Error']['Number'] . ' ' . $doc['Error']['Description']);
if (isset($doc['IntlRateV2Response']['Package']['Error'])) return array('error' => $doc['IntlRateV2Response']['Package']['Error']['Number'] . ' ' . $doc['IntlRateV2Response']['Package']['Error']['Description']);
if (isset($doc['IntlRateV2Response']['Package'][0]['Error'])) return array('error' => $doc['IntlRateV2Response']['Package']['Error'][0]['Number'] . ' ' . $doc['IntlRateV2Response']['Package'][0]['Error']['Description']);
if (isset($doc['IntlRateV2Response']['Package']['Service']['SvcDescription'])) { // single mail service response
$tmp = $this->_decode_intl_response($doc['RateV4Response']['Package']['Service'], $nonuspsinsurancecost, $pkg['item_price']);
if (!empty($tmp)) $quotes[$tmp['id']] = $tmp;
} elseif (isset($doc['IntlRateV2Response']['Package']['Service'][0])) { // multiple mailing services returned
foreach ($doc['IntlRateV2Response']['Package']['Service'] as $mailsvc) {
if (isset($mailsvc['SvcDescription'])) {
$tmp = $this->_decode_intl_response($mailsvc, $nonuspsinsurancecost, $pkg['item_price']);
if (!empty($tmp)) $quotes[$tmp['id']] = $tmp;
}
}


Thanks guys. I am trying to see if at least the Paypal orders hit the database, so it will narrow down the issue to the linkpoint module itself. I was working on the orders but all changes didn't fix anything, and like someone else said, the coding was a mess. I don't want to keep messing with those php's if in the end, it is ultimately an issue with the linkpoint module.

#2   MTG Mania

MTG Mania
  • Members
  • 55 posts

Posted 02 August 2012 - 16:51

Never mind we found the issue. $http->addHeader('Host', 'production.shippingapis.com); was missing an quotation at the end.

#3   multimixer

multimixer

    Lemons or Melons ?

  • Partner
  • 4,560 posts

Posted 02 August 2012 - 16:51

in line 1209 change this
$http->addHeader('Host', 'production.shippingapis.com);
to this
$http->addHeader('Host', 'production.shippingapis.com');

I suggest you to start using a proper php editor with syntax highlighting

#4   MTG Mania

MTG Mania
  • Members
  • 55 posts

Posted 02 August 2012 - 22:38

in line 1209 change this

$http->addHeader('Host', 'production.shippingapis.com);
to this
$http->addHeader('Host', 'production.shippingapis.com');

I suggest you to start using a proper php editor with syntax highlighting


Do you know of any good ones? we were using phpchecker, but that doesn't work all that great.

#5   MrPhil

MrPhil
  • Members
  • 5,185 posts

Posted 12 August 2012 - 22:58

I use the ViM editor. It color codes the syntax, and your omitted ' sticks out like a sore thumb. It's also an excellent editor (though not to everyone's liking).