Hi all...
I am getting an error Parse error: syntax error, unexpected $end in http:/..... on line 117...(117 is the EOF)..
can you plz help me out..I have checked out for the < , > ,{ ,} etc....
I donno where m wrong....
[code=php]
<?php
class S_Shipping {
// Private variables.
var $_access_key;
var $_username;
var $_password;
var $_request_optio n;
var $_ups_url;
var $_xml_request;
var $_xml_response;
function kS_Shipping() {
// Set defaults.
$this->_access_key = "";
$this->_username = "";
$this->_password = "";
$this->_request_optio n = "rate";
$this->_ups_url = "";
}
function getRate(
$package_weight ,
$shipto_postal_ code,
$shipto_country = "US",
$service_code = ""
) {
// commented out $residential = "<ResidentialAd dressIndicator/>";
$residential = "";
$this->_xml_request = <<<XML
<?xml version="1.0"?>
<AccessReques t xml:lang="en-US">
<AccessLicenseN umber>{$this->_access_key} </AccessLicenseNu mber>
<UserId>{$thi s->_username}</UserId>
<Password>{$thi s->_password}</Password>
</AccessRequest>
<?xml version="1.0"?>
<RatingServiceS electionRequest xml:lang="en-US">
<Request>
<TransactionRef erence>
<CustomerContex t> Shipping</CustomerContext >
<XpciVersion>1. 0001</XpciVersion>
</TransactionRefe rence>
<RequestAction> {$this->_request_optio n}</RequestAction>
<RequestOption> {$this->_request_optio n}</RequestOption>
</Request>
<PickupType>
<Code>01</Code>
</PickupType>
<Shipment>
<Shipper>
<Name>Office</Name>
<TaxIdentificat ionNumber>9</TaxIdentificati onNumber>
<PhoneNumber> </PhoneNumber>
<FaxNumber></FaxNumber>
<ShipperNumber> </ShipperNumber>
<Address>
<PostalCode></PostalCode>
<CountryCode>US </CountryCode>
</Address>
</Shipper>
<ShipTo>
<Address>
<PostalCode>{$s hipto_postal_co de}</PostalCode>
<CountryCode>{$ shipto_country} </CountryCode>
<residential> {$residential}</residential>
</Address>
</ShipTo>
<ShipFrom>
<Address>
<PostalCode></PostalCode>
<CountryCode> </CountryCode>
</Address>
</ShipFrom>
<Service>
<Code>{$service _code}</Code>
</Service>
<Package>
<PackagingTyp e>
<Code>02</Code>
</PackagingType>
<PackageWeigh t>
<UnitOfMeasurem ent>
<Code>LBS</Code>
</UnitOfMeasureme nt>
<Weight>{$packa ge_weight}</Weight>
</PackageWeight>
</Package>
<RateInformatio n>
<NegotiatedRate sIndicator/>
</RateInformation >
</Shipment>
</RatingServiceSe lectionRequest>
XML;
$http = curl_init() or die(curl_error( ));
curl_setopt($ht tp, CURLOPT_URL , $this->_ups_url);
curl_setopt($ht tp, CURLOPT_HEADER, false);
curl_setopt($ht tp, CURLOPT_POST, true);
curl_setopt($ht tp, CURLOPT_POSTFIE LDS, $this->_xml_request );
curl_setopt($ht tp, CURLOPT_RETURNT RANSFER, true);
$this->_xml_respons e = curl_exec($http );
curl_close($htt p);
// $xml = new SimpleXMLElemen t($xml_response );
return(XML_unse rialize($this->_xml_response) );
}
}
?>
[/code]
I am getting an error Parse error: syntax error, unexpected $end in http:/..... on line 117...(117 is the EOF)..
can you plz help me out..I have checked out for the < , > ,{ ,} etc....
I donno where m wrong....
[code=php]
<?php
class S_Shipping {
// Private variables.
var $_access_key;
var $_username;
var $_password;
var $_request_optio n;
var $_ups_url;
var $_xml_request;
var $_xml_response;
function kS_Shipping() {
// Set defaults.
$this->_access_key = "";
$this->_username = "";
$this->_password = "";
$this->_request_optio n = "rate";
$this->_ups_url = "";
}
function getRate(
$package_weight ,
$shipto_postal_ code,
$shipto_country = "US",
$service_code = ""
) {
// commented out $residential = "<ResidentialAd dressIndicator/>";
$residential = "";
$this->_xml_request = <<<XML
<?xml version="1.0"?>
<AccessReques t xml:lang="en-US">
<AccessLicenseN umber>{$this->_access_key} </AccessLicenseNu mber>
<UserId>{$thi s->_username}</UserId>
<Password>{$thi s->_password}</Password>
</AccessRequest>
<?xml version="1.0"?>
<RatingServiceS electionRequest xml:lang="en-US">
<Request>
<TransactionRef erence>
<CustomerContex t> Shipping</CustomerContext >
<XpciVersion>1. 0001</XpciVersion>
</TransactionRefe rence>
<RequestAction> {$this->_request_optio n}</RequestAction>
<RequestOption> {$this->_request_optio n}</RequestOption>
</Request>
<PickupType>
<Code>01</Code>
</PickupType>
<Shipment>
<Shipper>
<Name>Office</Name>
<TaxIdentificat ionNumber>9</TaxIdentificati onNumber>
<PhoneNumber> </PhoneNumber>
<FaxNumber></FaxNumber>
<ShipperNumber> </ShipperNumber>
<Address>
<PostalCode></PostalCode>
<CountryCode>US </CountryCode>
</Address>
</Shipper>
<ShipTo>
<Address>
<PostalCode>{$s hipto_postal_co de}</PostalCode>
<CountryCode>{$ shipto_country} </CountryCode>
<residential> {$residential}</residential>
</Address>
</ShipTo>
<ShipFrom>
<Address>
<PostalCode></PostalCode>
<CountryCode> </CountryCode>
</Address>
</ShipFrom>
<Service>
<Code>{$service _code}</Code>
</Service>
<Package>
<PackagingTyp e>
<Code>02</Code>
</PackagingType>
<PackageWeigh t>
<UnitOfMeasurem ent>
<Code>LBS</Code>
</UnitOfMeasureme nt>
<Weight>{$packa ge_weight}</Weight>
</PackageWeight>
</Package>
<RateInformatio n>
<NegotiatedRate sIndicator/>
</RateInformation >
</Shipment>
</RatingServiceSe lectionRequest>
XML;
$http = curl_init() or die(curl_error( ));
curl_setopt($ht tp, CURLOPT_URL , $this->_ups_url);
curl_setopt($ht tp, CURLOPT_HEADER, false);
curl_setopt($ht tp, CURLOPT_POST, true);
curl_setopt($ht tp, CURLOPT_POSTFIE LDS, $this->_xml_request );
curl_setopt($ht tp, CURLOPT_RETURNT RANSFER, true);
$this->_xml_respons e = curl_exec($http );
curl_close($htt p);
// $xml = new SimpleXMLElemen t($xml_response );
return(XML_unse rialize($this->_xml_response) );
}
}
?>
[/code]
Comment