2016-11-17 61 views
0

我正在嘗試使用Twilio PHP SDK查找電話號碼的運營商。 但是,我收到了認證錯誤。 我不知道我在做什麼錯。 如果有人能給我建議,我真的很感激! 謝謝。Twilio - 號碼查詢

$lookup_client = new Lookups_Services_Twilio($this->twilio_sid, $this->twilio_token); 

$number = $lookup_client->phone_numbers->get(
      '1-416-333-1111', 
      array(
       'Type'   => 'carrier', 
       "CountryCode" => "US", 
      ) 
); 
echo $number->carrier; 

Services_Twilio_TinyHttpException:SSL證書的問題,驗證該CA證書是確定。詳細信息:錯誤:14090086:SSL例程:SSL3_GET_SERVER_CERTIFICATE:證書驗證失敗在twilio的PHP \ SERVICES \ Twilio \ TinyHttp.php 119線上

+0

你應該檢查一下。 http://stackoverflow.com/questions/6400300/https-and-ssl3-get-server-certificatecertificate-verify-failed-ca-is-ok –

回答

0

我做了這個前一陣子。我也做到了你可以原始輸入電話號碼的地方。希望能幫助到你!

import sys 
import os 
from twilio.rest.lookups import TwilioLookupsClient 

try: 
    client = TwilioLookupsClient() 
    phone = raw_input (" Enter The Targets Phone Number: ") 

    number = client.phone_numbers.get((phone), include_carrier_info=True,) 
    print(number.carrier['name']) 
    print(number.carrier['type']) 
except: 
    print ("Error While Handling Phone Number")