pozdravi
Pisem, zapravo preuredjujem neki php4 kod za svoje potrebe, medjutim imam nekih problema, nece da mi vrati neke vrijednosti,
npr (objasnjenja problema se nalaze kao komentari poslije koda):
$sms= new SMS();
echo $sms->getsess_id(); //nece da vrati nikakvu vrijednost
echo $sms->$sess_id; // vraca broj sesije
echo $sms->creditCost($cellular_number); //nece da izvrsi funkciju jer joj nedostaje vrijednost varijable $sess_id koja se nalazi unutar klase
klasa se nalazi ispod, ne razumijem u cemu je problem meni sve djeluje ok:
class SMS
{
var $user = "aaa";
var $password = "aaa";
var $api_id = "aaa";
var $baseurl ="http://api.clickatell.com";
var $sess_id;
function SMS()
{
$url = sprintf("%s/http/auth?user=%s&password=%s&api_id=%s", $this->baseurl, $this->user, $this->password, $this->api_id);
$ret = file($url);
$sess = split(":",$ret[0]);
$this->$sess_id= trim($sess[1]);
}
function getsess_id()
{
return $this->sess_id;
}
function creditCost($cellular_number, $sess_id)
{
$url = sprintf("%s/utils/routeCoverage.php?session_id=%s&msisdn=%s", $this->baseurl, $this->sess_id, $cellular_number);
$ret = file($url);
$string=$ret[0];
$credit=explode("OK: This prefix is currently supported. Messages sent to this prefix will be routed. Charge: ",$string);
return $credit[1];
}
function sendSMS($from, $to, $text, $cellular_number)
{
$from = urlencode($from);
$text = urlencode($text);
$url = sprintf("%s/http/sendmsg?session_id=%s&to=%s&text=%s&from=%s", $this->baseurl, $this->sess_id, $cellular_number, $text, $from);
$ret = file($url);
$send = split(":",$ret[0]);
if ($send[0] == "ID")
{
return 1;
}
else
{
return 0;
}
}
};