HTTPS API - Przykład

PHP

przykład odbiera nieodebrane do tej pory SMSy przychodzące

<?php
$xml_request='<?xml version="1.0" encoding="UTF-8"?>
                <request version="1.0" user="htguserXXXX" password="YYYYYYYY">
                <receive_sms>
                        <type>unread</type>
                        <mark>true</mark>  
                </receive_sms>
                </request>';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://smesx1.smeskom.pl:2001/smesx");
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, "xml=".urlencode($xml_request));
$ret=curl_exec($ch);

if (curl_errno($ch)!=0) {
    echo "Error: ".curl_error($ch);
} else {
    $info = curl_getinfo($ch);
    echo "HTTP Code: ".$info['http_code']."\n"; // 200 - HTTPS ok

    $xml_response=simplexml_load_string($ret);
    echo "Status: ".$xml_response->execution_status."\n";
    echo "SMS Received: ".$xml_response->receive_sms->contain_sms."\n";
    echo "More SMSes waiting: ".$xml_response->receive_sms->has_more."\n";
    echo "XML String response: \n".$ret."\n";
}
curl_close($ch);
?>

Pobierz dokumentację do HTTPS Api ...