PHP CURL POST - xml response error

Om3n

New Member
I am trying to get a xml response from a external service as shown below. Using php Curl to post info and receiving the resposnse and trying to display in the browser.However I get the following error , XML Parsing Error: syntax errorLocation:Line Number 1, Column 1:Operation completed without any errors^can you help me whats the source of this and what does this error imply? Below is my code\[code\]<?phpheader ("Content-type: text/xml");//defining $vars here...not shonw for simplicity$url = 'http://secure.leadexec.net/leadimport.asmx/LeadReceiver';$myvars = '&VID=' . $lead_id . '&LID=' . '2' . '&AID=' . $lead_id . '&FirstName=' . $fname . '&LastName=' . $lname . '&Email=' . $email . '&MoveDate='. $move_date . '&Telephone=' . $phone . '&Address=' . $address . '&Website=' . $website . '&Zip=' . $zipcode . '&ServicesNeeded=' . $services . '&RequestaQuote=' . $requestquote . '&NumberofEmployees=' . $no_of_employees . '&CompanyName=' . $company_name;$ch = curl_init();curl_setopt( $ch, CURLOPT_VERBOSE, 1); curl_setopt( $ch, CURLOPT_URL, $url);curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1);curl_setopt( $ch, CURLOPT_HTTPHEADER, Array("Content-Type: text/xml"));curl_setopt( $ch, CURLOPT_HEADER, 0);curl_setopt( $ch, CURLOPT_TIMEOUT, 40); curl_setopt( $ch, CURLOPT_POSTFIELDS, $myvars);curl_setopt( $ch, CURLOPT_POST, 1);$response = curl_exec($ch);if(curl_exec($ch) === false){ echo 'Curl error: ' . curl_error($ch);}else{ echo 'Operation completed without any errors';}$oXML = new SimpleXMLElement($response);foreach($oXML->entry as $oEntry){ echo $oEntry->title . "\n";}if(curl_errno($ch))print curl_error($ch);elseprint_r($response);curl_close($ch);?>\[/code\]
 
Back
Top