I found this code that I want to adapt for a project that I am working on and I cannot figure out where the issue is. I have end ; on each line, my single quotes all are good, and I only have one set of curly brackets...I need HELP!!
Thanks in advance!!Code:<?php function validateAddress(){ $xmlstr = <<<XML <AddressValidateRequest USERID="XXXXXXXXX"> <Address ID="0"> <Address1></Address1> <Address2></Address2> <City></City> <State></State> <Zip5></Zip5> <Zip4></Zip4> </Address> </AddressValidateRequest> XML; $xml = new SimpleXMLElement($xmlstr); $h = new http(); // Populate Address $xml->Address->Address2 = 'MyAddress'; $xml->Address->Address1 = ''; $xml->Address->City = 'MyCity'; $xml->Address->State = 'MYState'; $xml->Address->Zip5 = 'MyZip'; // Prepare for XML call $h->xmlrequest = $xml->asXML(); $output = str_replace(array("\n",'<?xml version="1.0"?>',"\t",),array('','',''), $xml->asXML()); $url = 'http://TESTING.ShippingAPIs.com/ShippingAPItest.dll?API=Verify&XML='.urlencode($output); // Submit data and get results $h->fetch($url,0,'','','','GET'); print_r($h->body); die(); // Put results into XML object $xml = new SimpleXMLElement($h->body); return $xml; } $xmlverify = validateAddress(); print_r($xmlverify); ?>
D





Reply With Quote