I have controller that send request using HTTP Socket and give response in xml format. I am using cakephp 2.6. Here is my code to get response body:
$HttpSocket = new HttpSocket();
$response = $HttpSocket->request($request);
$resulthit = $response->body;
When I try print the response body it return like this in my browser:
-2201502101153512eFXcByWLUHvQmYC0EHMn2JVxcpyzozBcek uid dan pwd
But when I try see the source of page:
<pre><? xml version="1.0" ?><PUSH><STATUS>-2</STATUS><SMSCMESSAGEID>20150210133953</SMSCMESSAGEID><GUID>knDlIBuUZf6zixlhbbxxLoxhEUGZTWPD</GUID><MSG>cek uid dan pwd</MSG></PUSH></pre>
My problem is How I can get value of XML element above? in this case I want the STATUS and GUID
I already try
$xml = new SimpleXMLElement($resulthit);
But only get error in return say that "String could not be parsed as XML"
No comments:
Post a Comment