2016-03-21 29 views
2

SMS Ağ Geçidi PHP API kullanmak istiyorum ancak kullanmakta başarılı değilim. Ben telefon ile SMSGATEWAY.ME gelen yazılım indirilen ve bir hesap oluşturdu.Ben de ücretsiz bir web sunucusu var ve ben bu iki belge yükledim:SMSGATEWAY.ME - PHP API nasıl kullanılır?

insanların PHP API Kütüphanesi "smsGateway.php" https://smsgateway.me/sms-api-libraries/sms-gateway-me-php.zip

benim dosyası "test.php": burada

<?php 
include "smsGateway.php"; 
$smsGateway = new SmsGateway('my_email_on_their_website', 'my_password_for_this_account'); 

$deviceID = 111111; //the number of my device, displayed on their website or on the software installed on my phone 
$number = '+1234567891'; //the number I want to SMS 
$message = 'Hello World!'; //my message 

$options = [ 
    'send_at' => strtotime('+10 minutes'), // Send the message in 10 minutes 
    'expires_at' => strtotime('+1 hour') // Cancel the message in 1 hour if the message is not yet sent 
]; 

//Please note options is no required and can be left out 
$result = $smsGateway->sendMessageToNumber($number, $message, $deviceID, $options); 
?> 

Ama tarayıcımla http://mywwebsite.com/test.php ile ziyarete geldiğimizde, SMS göndermek değil, siz niye lütfen biliyor musunuz? Bu sorunu düzeltmeme yardım eder misiniz lütfen? (Telefonumdaki ağ geçidi hala aktif durumda).

Teşekkürler!

Saygılarımızla

+0

benzeyecek? – walkingRed

+0

Programımın son satırına "echo $ sonuç" eklediğimde ve bunu test ettiğimde, ekranda görüntülenir: "Önemli hata: Sınıf 'msGateway' /srv/disk13/2087179/www/mywebsite.com adresinde bulunamadı /test.php on line 6 " – Olscream

+0

" smsGateway.php "dosyasının" test.php " – walkingRed

cevap

0

Kodunuz doğru. Eğer görüntülemek istiyorsanız sonuç sonrasında aşağıdaki satırı yazmak $result değişken

echo json_encode($result); 

Yani kod `$ result` değer sağlayacak Could bu

<?php 
    include "smsGateway.php"; 
    $smsGateway = new SmsGateway('my_email_on_their_website', 'my_password_for_this_account'); 

    $deviceID = 111111; //the number of my device, displayed on their website or on the software installed on my phone 
    $number = '+1234567891'; //the number I want to SMS 
    $message = 'Hello World!'; //my message 

    $options = [ 
     'send_at' => strtotime('+10 minutes'), // Send the message in 10 minutes 
     'expires_at' => strtotime('+1 hour') // Cancel the message in 1 hour if the message is not yet sent 
    ]; 

    //Please note options is no required and can be left out 
    $result = $smsGateway->sendMessageToNumber($number, $message, $deviceID, $options); 
echo json_encode($result); 
    ?>