socket output xml
Posted: Mon May 19, 2014 5:51 am
I pass a xml string in php socket and it returns me below xml as reply in $code; variable,
I want to print only value of which is 60.. pls guide how to extract that value from those tags
Code: Select all
<tel><header><responsetype>stock</responsetype></header><response><resultcode>60</resultcode><resultdescription>Invalid PIN</resultdescription><source>345</source><requestcts>19/05/2014 09:55:18 AM</requestcts><responsects>19/05/2014 09:55:18 AM</responsects><vendorcode>our</vendorcode></response></tel>Code: Select all
<resultcode>60</resultcode>Code: Select all
$fp = fsockopen($host, $port ,$errno, $errstr, 30);
if (!$fp) {
print 'COULD NOT CONNECT! <br />';
echo "$errstr ($errno)<br />\n";
die();
}
else
fputs ($fp, $xml."\n" );
#echo fread($fp, 1024);
$code=fread($fp, 1024);
print $code;