I have a xml that I need to submit using PHP. From the 3 PHP variables in the xml, $shippingMode is a string and it's not being passed properly. I've tried multiple ways but nothing helps. Here is the code:
$zip = 90002;
$pounds = 0.1;
$shippingMode = "Express";
function USPSParcelRate($pounds,$zip) {
$url = "http://production.shippingapis.com/shippingAPI.dll";
$devurl ="testing.shippingapis.com/ShippingAPITest.dll";
$service = "RateV4";
$xml = rawurlencode("<RateV4Request USERID='USER' >
<Revision/>
<Package ID='1ST'>
<Service>'".$shippingMode."'</Service>
<ZipOrigination>10025</ZipOrigination>
<ZipDestination>".$zip."</ZipDestination>
<Pounds>".$pounds."</Pounds>
<Ounces>0</Ounces>
<Container></Container>
<Size>REGULAR</Size>
<Width></Width>
<Length></Length>
<Height></Height>
<Girth></Girth>
</Package>
</RateV4Request>");
I've also tried putting $shippingMode directly without concatenating. Or just ".$shippingMode."
Any idea of which is the safest and proper way to have a string within the XML?