User Tools

Site Tools


invio_php_http_get

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
invio_php_http_get [2020/08/01 22:57]
dcantaluppi created
invio_php_http_get [2023/12/29 14:29] (current)
Line 1: Line 1:
-Access +====== invio PHP HTTP GET ====== 
-Webservices URL: https://www.smskdev.it/highway/index.php?app=ws +==== Esempio API ==== 
- +<code> 
-Parameters +    <? 
-Listed in the below table are webservices parameters for individual tasks. +      
- +    //////////////////sms_sender.php////////////////// 
-Name Description +    //PURPOSESEND SMS USING KDEV GATEWAY // 
-h webservices token, configured by user from Preferences menu +    //AUTHOR: Davide Cantaluppi <[email protected]> // 
-u username +    //V2-Rev. 0 // 
-p password, supplied for op=get_token +    //PLATFORM: Not platform dependent // 
-op operation or type of action +    //DEPEND: PHP >4.1.2; libcurl extension // 
-format output format selection +    // Secured SSL // 
-from SMS sender ID (for op=pv+    //Keep parameters in a safe place // 
-to destination numbers@username or #groupcodemay use commas +    //////////////////sms_sender.php////////////////// 
-footer SMS footer (for op=pv+      
-nofooter remove SMS footer +    //OUTPUT of the call 
-msg message (+ or %20 for spacesurlencode for non ascii chars+    //https://www.smskdev.it/send.php?user=utente&passkey=password&to=39XXXXXXX&text=messaggio+test 
-schedule schedule message deliveryformat: YYYY-MM-DD hh:mm:ss +      
-type message type (flash or text+    //PARAMETERS 
-unicode whether message unicode or not (1=unicode0=not unicode+      
-queue queue code +    $username="username"; 
-src sender number or ID +    $password="password"; 
-dst destination number (single number+    $to="39destinatario"; 
-dt send SMS date/time +    $text="testo del messaggio"; 
-smslog_id SMS Log ID +      
-last last SMS log ID (this number not included on result+    //function for send.php call in GET require curl compiled inside PHP 
-c number of delivery status that will be retrieved +    //DEFAULT CHOICE 
-kwd keyword +      
-login_key login key sets by admin through webservices call op=loginkeyset +      
-query query server for useful information +    function get_url$url, $javascript_loop 0, $timeout = 5 
-Listed in the below table are webservices parameters for admin tasks. +    { 
- +    $url = str_replace( "&amp;""&"urldecode(trim($url)) ); 
-Name Description +    $cookie = tempnam ("/tmp""CURLCOOKIE"); 
-recvnum receiver number (for op=inject+    $ch = curl_init(); 
-smsc SMSC (for op=inject+    curl_setopt( $chCURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; rv:1.7.3) Gecko/20041001 Firefox/0.10.1" ); 
-data_* admin tasks related supplied data +    curl_setopt$ch, CURLOPT_URL, $url ); 
-Please note that all values should be URL encoded. +    curl_setopt$chCURLOPT_COOKIEJAR, $cookie ); 
- +      
-Return Codes +    curl_setopt$ch, CURLOPT_FOLLOWLOCATION, true ); 
-Below table listed return coded after unsuccessful call to a webservices operation. Successful operation will returns an OK data in the response message. +      
- +    curl_setopt( $ch, CURLOPT_ENCODING, "" ); 
-Please note that by default the response message is a JSON encoded message. +      
- +    curl_setopt$ch, CURLOPT_RETURNTRANSFER, true ); 
-Error code Description +      
-ERR 100 authentication failed +    curl_setopt( $ch, CURLOPT_AUTOREFERER, true ); 
-ERR 101 type of action is invalid or unknown +      
-ERR 102 one or more field empty +    curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false ); # required for https urls 
-ERR 103 not enough credit for this operation +      
-ERR 104 webservice token is not available +    curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT, $timeout ); 
-ERR 105 webservice token not enable for this user +      
-ERR 106 webservice token not allowed from this IP address +    curl_setopt$ch, CURLOPT_TIMEOUT, $timeout )
-ERR 200 send message failed +      
-ERR 201 destination number or message is empty +    curl_setopt$ch, CURLOPT_MAXREDIRS, 10 ); 
-ERR 400 no delivery status available +      
-ERR 401 no delivery status retrieved and SMS still in queue +    $content = curl_exec( $ch ); 
-ERR 402 no delivery status retrieved and SMS has been processed from queue +      
-ERR 501 no data returned or result is empty +    $response = curl_getinfo( $ch ); 
-ERR 600 admin level authentication failed +      
-ERR 601 inject message failed +    curl_close ( $ch ); 
-ERR 602 sender id or message is empty +      
-ERR 603 account addition failed due to missing data +      
-ERR 604 fail to add account +    if ($response['http_code'] == 301 || $response['http_code'] == 302) 
-ERR 605 account removal failed due to unknown username +      
-ERR 606 fail to remove account +    { 
-ERR 607 set parent failed due to unknown username +      
-ERR 608 fail to set parent +    ini_set("user_agent", "Mozilla/5.0 (Windows; U; Windows NT 5.1; rv:1.7.3) Gecko/20041001 Firefox/0.10.1"); 
-ERR 609 get parent failed due to unknown username +      
-ERR 610 fail to get parent +      
-ERR 611 account ban failed due to unknown username +      
-ERR 612 fail to ban account +    if ( $headers = get_headers($response['url']) ) 
-ERR 613 account unban failed due to unknown username +      
-ERR 614 fail to unban account +    { 
-ERR 615 editing account preferences failed due to missing data +      
-ERR 616 fail to edit account preferences +    foreach( $headers as $value ) 
-ERR 617 editing account configuration failed due to missing data +      
-ERR 618 fail to edit account configuration +    { 
-ERR 619 viewing credit failed due to missing data +      
-ERR 620 fail to view credit +    if ( substr( strtolower($value), 0, 9 ) == "location:" ) 
-ERR 621 adding credit failed due to missing data +      
-ERR 622 fail to add credit +    return get_url( trim( substr( $value, 9, strlen($value) ) ) ); 
-ERR 623 deducting credit failed due to missing data +      
-ERR 624 fail to deduct credit +    } 
-ERR 625 setting login key failed due to missing data +      
-ERR 626 fail to set login key +    } 
-There might appear new error codes in the future, you should be aware that new codes might appear in this syntax: +      
- +    } 
-Error code Description +      
-ERR 1xx authentication or parameter erorrs +      
-ERR 2xx specific pv errors +      
-ERR 4xx delivery status errors +    if ( ( preg_match("/>[[:space:]]+window\.location\.replace\('(.*)'\)/i", $content, $value) || preg_match("/>[[:space:]]+window\.location\=\"(.*)\"/i", $content, $value) ) && 
-ERR 5xx others +      
-ERR 6xx administrative tasks +    $javascript_loop < 5 
-Protocol for non-admin tasks +      
-Send message +    ) 
-Send message to a single or multiple mobile numbers, @username or #groupcode +      
- +    { 
-Parameters Name or description +      
-Operation pv +    return get_url( $value[1], $javascript_loop+1 ); 
-Mandatory u h to msg +      
-Optional type unicode from footer nofooter format schedule +    } 
-Returns return codes +      
-Parameter to can be international formatted mobile number, #groupcode or @username, or a mix of them. Separate by commas for multiple value.+    else 
 +      
 +    { 
 +      
 +    return $content; 
 +      
 +    } 
 +      
 +    } 
 +      
 +      
 +    $url = 'https://www.smskdev.it/send.php?user='.urlencode($username)."&passkey=".urlencode($password)."&to=".urlencode($destination)."&text=".urlencode($text); 
 +      
 +    $response = get_url($url); 
 +      
 +    echo $response; 
 +      
 +    ?> 
 +</code>
invio_php_http_get.1596322652.txt.gz · Last modified: 2023/12/29 14:29 (external edit)