SMS servic PHP pomoc!

SMS servic PHP pomoc!

offline
  • Pridružio: 27 Feb 2013
  • Poruke: 1

Pozdrav svima, imam jedno pitanje nadam se da ce neko znati odgovor posto su kod nas ti sms servisi veoma zastupljeni. Pokusavam srediti svoju skriptu za Fortumo SMS placanje , ali imam jedan problem u svemu tome.

Bazu i ostatak skripte radi , ali kada izvrsim naplatu po php kodu (ispod )trebao bi valjda dobiti podatke o naplati od fortuma , koji bi se smjestili u bazu.

Ja potrosim 1euro a baza mi ostaje prazna Very Happy

Dali sam ja nesto pogresio ili sta volio bih znati i nadam se da ce mi neko uspjeti reci sta i kako. Smile

Hvala

Fortumo API specifikacija : developers.fortumo.com/api/service-setup



sms.php
Citat:[PHP]<?php

include('db.php');
//set true if you want to use script for billing reports
//first you need to enable them in your account
$billing_reports_enabled = true;

// check that the request comes from Fortumo server
if(!in_array($_SERVER['REMOTE_ADDR'],
array('81.20.151.38', '81.20.148.122', '79.125.125.1', '209.20.83.207'))) {
header("HTTP/1.0 403 Forbidden");
die("Error: Unknown IP");
}

// check the signature
$secret = '1c7b1bb53584d857df0e68a63bd3885f'; // THIS IS MY TEST SERVICE SECRET CODE ''
if(empty($secret) || !check_signature($_GET, $secret)) {
header("HTTP/1.0 404 Not Found");
die("Error: Invalid signature");
}

$sender = $_GET['sender'];
$message = $_GET['message'];
$message_id = $_GET['message_id'];//unique id

$res = mysql_query("INSERT INTO last_payment SET sender='".$sender."', message='".$message."',message_id='".$message_id."'");

//hint:use message_id to log your messages
//additional parameters: country, price, currency, operator, keyword, shortcode
// do something with $sender and $message
$reply = "$message unesite sledeci kod kada bude potrebno ($message_id)";

// print out the reply
echo($reply);

//customize this according to your needs
if($billing_reports_enabled
&& preg_match("/Failed/i", $_GET['status'])
&& preg_match("/MT/i", $_GET['billing_type'])) {
// find message by $_GET['message_id'] and suspend it
}

function check_signature($params_array, $secret) {
ksort($params_array);

$str = '';
foreach ($params_array as $k=>$v) {
if($k != 'sig') {
$str .= "$k=$v";
}
}
$str .= $secret;
$signature = md5($str);

return ($params_array['sig'] == $signature);
}
?>[/PHP]


db.php

Citat:[PHP]
<?php
$dbname = "fortumo";
$dbhost = "localhost";
$dbuser = "admin";
$dbpass = "admin"; // connect mysql

function connectdb(){

global $dbname, $dbuser, $dbhost, $dbpass;
$conms = @mysql_connect($dbhost,$dbuser,$dbpass);

if(!$conms) return false;
$condb = @mysql_select_db($dbname);

if(!$condb) return false;
return true;

}
connectdb();

?>[/PHP]



Citat:

Struktura tabele `last_payment`--


CREATE TABLE IF NOT EXISTS `last_payment` (
`id` varchar(500) NOT NULL DEFAULT '',
`sender` varchar(500) NOT NULL DEFAULT '',
`message` varchar(500) NOT NULL DEFAULT '',
`message_id` varchar(500) NOT NULL DEFAULT '',
PRIMARY KEY (`sender`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;




Registruj se da bi učestvovao u diskusiji. Registrovanim korisnicima se NE prikazuju reklame unutar poruka.
Ko je trenutno na forumu
 

Ukupno su 951 korisnika na forumu :: 42 registrovanih, 2 sakrivenih i 907 gosta   ::   [ Administrator ] [ Supermoderator ] [ Moderator ] :: Detaljnije

Najviše korisnika na forumu ikad bilo je 3466 - dana 01 Jun 2021 17:07

Korisnici koji su trenutno na forumu:
Korisnici trenutno na forumu: A.R.Chafee.Jr., amaterSRB, babaroga, bbogdan, Bobrock1, cavatina, ccoogg123, Denaya, DonRumataEstorski, Dorcolac, FOX, gasha, janbo, Jeremiah, Kriglord, Kubovac, kubura91, ladro, lord sir giga, Lošmi, Marko Marković, mercedesamg, Mi lao shu, Milometer, MiroslavD, mkukoleca, mocnijogurt, nikoli_ca, Panter, pein, radoznao, Rema000, Sirius, sokars, srbijaiznadsvega, ss10, Stoilkovic, Tvrtko I, vathra, Vlada1389, Vlada78, vladas87