2016-09-20 112 views
1

我正在測試Clickatell API以將基於php的應用程序中的SMS確認集成到一起,我用他們的其餘api將消息發送給我自己來測試,但消息從未到達。Clickatell API將成功發送消息,但我永遠不會收到消息

我嘗試

我用這個https://www.clickatell.com/developers/api-docs/get-coverage-rest/檢查覆蓋面,這是JSON響應:

object(stdClass)[54] 
    public 'data' => 
    object(stdClass)[57] 
     public 'routable' => boolean true 
     public 'destination' => string ' 21655609125' (length=12) 
     public 'minimumCharge' => float 0.8 

我也確信該消息實際上是通過檢查狀態發送;這是JSON響應:

object(stdClass)[54] 
    public 'data' => 
    object(stdClass)[57] 
     public 'charge' => float 0.8 
     public 'messageStatus' => string '004' (length=3) 
     public 'description' => string 'Received by recipient' (length=21) 
     public 'apiMessageId' => string 'b57f4a28dece65a134b56be2010c8a78' (length=32) 
     public 'clientMessageId' => string '' (length=0) 

我又試圖自己的網站發送的消息報道,這就是我所看到的:

測試Clickatell的網關覆蓋短信內容感謝。在購買郵件信用額後,您可以在 之後更改郵件的內容。

移動網突尼斯:橙色21655609125

由收件人收到(狀態4)

但我從來沒有收到消息自己。可能是什麼問題?

編輯:這裏是滿級我在我的應用程序中使用目前

<?php 

if (! defined('ABSPATH')) { 
    exit; // Exit if accessed directly 
} 

/** 
* MC_SMS class 
*/ 
class MC_SMS { 

    public $rest_uri = 'https://api.clickatell.com/rest'; 
    public $method  = 'post'; 
    public $args  = array(); 

    /** 
    * Constructor 
    */ 
    public function __construct($action, $data = null) { 

     $this->data = $data; 
     $this->init(); 

     switch($action) : 

      // Send message 
      case 'send' : 

       $this->endpoint = '/message'; 
       $this->method = 'post'; 

       break; 

      // Message status 
      case 'status' : 

       $this->endpoint = '/message/' . $data; 
       $this->method = 'get'; 

       break; 

      // Network coverage 
      case 'coverage' : 

       $this->endpoint = '/coverage/' . $data; 
       $this->method = 'get'; 

       break; 

      // Account balance 
      case 'balance' : 

       $this->endpoint = '/account/balance'; 
       $this->method = 'get'; 

       break; 

     endswitch; 

     $this->queried_uri = $this->rest_uri . $this->endpoint; 
     $this->do_request(); 

     $this->response = (isset($this->response_body['body'])) ? json_decode($this->response_body['body']) : null; 
    } 

    /** 
    * Init. 
    */ 
    public function init() { 
     $this->headers = array(
       'X-Version'  => 1, 
       'Authorization' => 'Bearer ClHrbIEo_LwAlSVTSMemBIA5Gmvz8HNb5sio3N9GVDdAO_PPJPaZKzdi8Y8cDSmrs4A4', 
       'Content-Type' => 'application/json', 
       'Accept'  => 'application/json' 
     ); 

     $this->data = (! empty($this->data) && is_array($this->data)) ? json_encode($this->data) : null; 

     $this->args['headers'] = $this->headers; 

     if ($this->data) { 
      $this->args['body'] = $this->data; 
     } 
    } 

    /** 
    * Do the API request 
    */ 
    public function do_request() { 

     if ($this->method == 'get') { 
      $this->response_body = wp_remote_get($this->queried_uri, $this->args); 
     } 

     if ($this->method == 'post') { 
      $this->response_body = wp_remote_post($this->queried_uri, $this->args); 
     } 
    } 

} 
+0

您是否支付過帳戶? – WillardSolutions

+0

還不是:)我只是測試它與測試學分,以決定它是否適用於我的應用程序。 –

+0

發佈您實際用於發送消息的代碼 – WillardSolutions

回答

1

之前支付的錢,而使用試用學分,達到了你的消息是文本: 消息內容感謝測試Clickatell的網關覆蓋。在您首次購買郵件點數後,您將能夠更改郵件的內容。

這意味着您已成功向您的設備發送和接收短信。您只有在付款後才能看到自己的實際消息。

0

進行了擴展,@Dimitris Magdalinos' answer這似乎是正確的,following documentation has this to say(重點煤礦):

就可以開始測試使用章「日常任務」中規定了方法的網關。但是,請注意,如果您使用的附帶帳戶10個免費短信學分,直到您已經購買學分的Clickate將取代謝謝你的文字像下面的短信內容:

感謝測試Clickatell的網關覆蓋。在您首次購買郵件點數後,您將能夠更改郵件的內容。

相關問題