Issue
I have this curl code:
curl -X GET https://lookups.twilio.com/v1/PhoneNumbers/(919) 410-7522\
-d "Type=carrier"
-u "{AccountSid}:{AuthToken}"
I try to convert in PHP cURL but I stack on how to send AccountSid
and AuthToken
.
I need this code only to check if number is valid and mobile or landline.
How to do that? Thanks!
Solution
Just use CURLOPT_USERPWD
option
$ch = curl_init("https://lookups.twilio.com/v1/PhoneNumbers/(919)%20410-7522");
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($ch, CURLOPT_POSTFIELDS, "Type=carrier");
curl_setopt($ch, CURLOPT_USERPWD, "{AccountSid}:{AuthToken}");
$response = curl_exec($ch);
Answered By - hlscalon Answer Checked By - Terry (PHPFixing Volunteer)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.