glabsdev / php

Globe Labs PHP sample codes
10 stars 12 forks source link

Can't send message and no errors. #1

Closed kennCK closed 4 years ago

kennCK commented 4 years ago

$shortcode = "**"; $access_token = "";I don't know this $address = "***"; $clientCorrelator = "264801"; I don't know this $message = "PHP SMS Test"; $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => "https://devapi.globelabs.com.ph/smsmessaging/v1/outbound/".$shortcode."/requests?access_token=".$access_token , CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_POSTFIELDS => "{\"outboundSMSMessageRequest\": { \"clientCorrelator\": \"".$clientCorrelator."\", \"senderAddress\": \"".$shortcode."\", \"outboundSMSTextMessage\": {\"message\": \"".$message."\"}, \"address\": \"".$address."\" } }", CURLOPT_HTTPHEADER => array( "Content-Type: application/json" ), )); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; }

kennCK commented 4 years ago

The error is "Authentication failed".

glabsdev commented 4 years ago

Hi,

You need to do the opt-in process first. Please refer to this document: http://www.globelabs.com.ph/docs/#getting-started-opt-in-via-sms For faster coordination, kindly email api@globe.com.ph for your concerns.

Thanks!

kennCK commented 4 years ago

Btw, still the same error on outbound sms. I added my shortcode, app_id and secret but still getting the "Authentication failed".