Pogledajte određenu poruku
Staro 15. 03. 2011.   #1
webarto
expert
Grand Master
 
Avatar webarto
 
Datum učlanjenja: 11.04.2010
Poruke: 998
Hvala: 141
959 "Hvala" u 153 poruka
webarto is on a distinguished roadwebarto is on a distinguished roadwebarto is on a distinguished roadwebarto is on a distinguished roadwebarto is on a distinguished roadwebarto is on a distinguished roadwebarto is on a distinguished roadwebarto is on a distinguished road
Default Clickatell PHP Class

PHP class za clickatell (SMS) API...

http://webarto.com/79/php-clickatell-class

PHP kôd:
$sms = new SMS;
$x $sms->send("38761058505""Hello");
echo 
$x// Message SENT! 
PHP kôd:
<?php

/**
 * @author Webarto
 * @copyright 2011
 */

class SMS{
    
    var 
$user "webarto";
    var 
$password "";
    var 
$api "";
    var 
$url "http://api.clickatell.com";
    
    public function 
send($to$text){
        global 
$url$user$password$api;
        
$auth $this->curl($this->url."/http/auth?user=".$this->user."&password=".$this->password."&api_id=".$this->api);
        
$auth explode(":"$auth);
        if(
$auth[0] == "OK"){
            
$text trim($text);
            
$text urlencode($text);
            
$text substr($text0160);
            
            
$status $this->curl($this->url."/http/sendmsg?user=".$this->user."&password=".$this->password."&api_id=".$this->api."&to=$to&text=$text");
            
$status explode(":"$status);
            if(
$status[0] == "ID"){
                return 
"Message SENT!";
            }else{
                return 
"Message NOT SENT!";    
            }
        }else{
            return 
"Authentication FAILED!";
        }
               
    }

    private function 
curl($url){
        
$ch curl_init();
        
curl_setopt($chCURLOPT_URL$url);
        
curl_setopt($chCURLOPT_RETURNTRANSFER1);
        return 
curl_exec($ch);
        
curl_close($ch);
    }      

}

?>
Ima već na njihovom siteu ali meni lično nije bilo nešto korisno... http://www.clickatell.com/developers/php.php
webarto je offline   Odgovorite uz citat
2 članova zahvaljuje webarto za poruku: