1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
| <?php
// 2tehm's POST URL
$postUrl = "http://api2.2tehm.net/api/sendsms/xml";
// XML-formatted data
$xmlString =
"<SMS>
<authentification>
<username>****</username>
<password>***</password>
</authentification>
<message>
<sender>EKJP</sender>
<text>Test delphi SMS send </text>
</message>
<recipients>
<gsm>22547614017</gsm>
</recipients>
</SMS>";
// previously formatted XML data becomes value of "XML" POST variable
$fields = "XML=" . urlencode($xmlString);
// in this example, POST request was made using PHP's CURL
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $postUrl);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);
// response of the POST request
$response = curl_exec($ch);
curl_close($ch);
// write out the response
echo $response;
?> |