I am new in php programming and I would like to add data to my http request in xml format. I use curl to generate HTTP request using this PHP code :
<?php
$fields = array( 'SERIAL_NUMBER ' => urlencode('123456'),
'HARDWARE_ID ' => urlencode('455FFG'),
'CODE ' => urlencode('99'),
//field goes here
);
foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; }
rtrim($fields_string, '&');
$ch = curl_init("http://ift.tt/1w6tCvh");
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 0);
$output = curl_exec($ch);
curl_close($ch);
echo $output;
?>
I would like to add fields array [ SERIAL_NUMBER and HARDWARE_ID and CODE ] as data in http request in format xml Note : my server listen to port 10000 @ any help is appreciated
No comments:
Post a Comment