Dear Gurus,
i am trying to connect to a remote Server via https and fire some XML commands. how cal i do it. the following are the steps:
Step 1. URL
https://IP:894/Receiver?CODE=GW&LOGIN=username&PASSWORD=je0b12221a0558c&SOURCE_TYPE=EXT&SERVICE_PORT=200
Step 2. XML
<?xml version=“1.0”?><COMMAND><TYPE>EXRCTRFREQ</TYPE><DATE>12/03/13</DATE><EXTNWCODE>ZM</EXTNWCODE><MSISDN>9936574991</MSISDN><EXTREFNUM></EXTREFNUM><MSISDN2>9798144059</MSISDN2><AMOUNT>1</AMOUNT><SELECTOR>1</SELECTOR></COMMAND>
How can this be done. this is what i came up with but am stuck with pass the URL GET parameter.
<?php
$site = "IP:894";
$loc = "Receiver?CODE=GW&LOGIN=username&PASSWORD=je0b12221a0558c&SOURCE_TYPE=EXT&SERVICE_PORT=200";
$BODY = "<?xml version=\\"1.0\\"?>
<COMMAND>
<TYPE>EXRCTRFREQ</TYPE>
<DATE>12/03/13</DATE>
<EXTNWCODE>ZM</EXTNWCODE>
<MSISDN>9936574991</MSISDN>
<EXTREFNUM></EXTREFNUM>
<MSISDN2>9798144059</MSISDN2>
<AMOUNT>1</AMOUNT>
<SELECTOR>1</SELECTOR>
</COMMAND>
";
echo $out=XML_request($site,$loc,$BODY);
function XML_request($site, $location, $data){
$site = explode(':', $site);
if(isset($site[1]) and is_numeric($site[1])){
$port = $site[1];
}else{
$port = 80;
}
$return='';
$site = $site[0];
$conn = fsockopen ("ssl://".$site, $port,$errno,$errstr,30); #open the connection
if(!$conn){ #if the connection was not opened successfully
$response="Issues";
}else{
fputs($conn, $data);
#socket_set_blocking ($conn, false);
$response = "";
while(!feof($conn)){
$response .= fgets($conn, 1024);
}
$return=$response;
fclose($conn);
}
return $return;
}
?>
Please help