Giter VIP home page Giter VIP logo

php's Introduction

php

Globe Labs PHP sample codes

==============================================================================

Sending SMS (sms-mt)

Shortcode
- Your shortcode suffix (last 4 digits)

access_token
- Contains security information for transacting with a subscriber. Subscriber needs to grant an app first via SMS or Web Form Subscriber Consent Workflow.

address
- Target number

clientCorrelator
- Uniquely identifies this create SMS request. If there is a communication failure during the request, using the same clientCorrelator when retrying the request allows the operator to avoid sending the same SMS twice.

message
- Must be provided within the outboundSMSTextMessage element. Currently, the API implementation is limited a maximum of 160 characters. Also make sure that your language or framework’s editor is encoding the HTTP parameters as UTF-8

==============================================================================

Location Based Services (lbs)

access_token
- Contains security information for transacting with a subscriber. Subscriber needs to grant an app first via SMS or Web Form Subscriber Consent Workflow.

address
- Target number

requestedAccuracy
- The preferred accuracy of the result, in meters. Typically, when you request an accurate location it will take longer to retrieve than a coarse location. So requestedAccuracy=10 will take longer than requestedAccuracy=100 

==============================================================================

Charging

app_id
- Unique identifier of your app

app_secret
- The security code of your app

access_token
- Identifier retrieved upon completing the opt-in process 

amount
- Amount to be charged. Must be in decimal format. eg. 1.00, 2.50, 10.00

code
- Needed to retrive the access_token. Sent to your redirect_uri after the opt-in process

description
- Is the human-readable text to appear on the bill, so the user can easily see what they bought

endUserId / subscriber_number
- Target number

referenceCode
- Is a unique alphanumeric code for records matching. The operator should include it in reports so that you can match their view of what has been sold with yours by matching the referenceCodes. Required format: Suffix of your shortcode (last 4 digits) + Unique combination of 7 alphanumeric string, but we recommend that you do Increments of 1 from 1000000 for faster tracking. e.g. [1234]1000001 to [1234]9999999]

transactionOperationStatus
- A mandatory parameter that should always be set to Charged

duration
- This defines how many days the subscriber will be subscribed to the promo(duration=0 for one-time charging).

==============================================================================

Load API and Load Status

app_id
- Unique identifier of your app

app_secret
- The security code of your app

rewards_token
- This is used as a key to allow your app to send rewards

address
- Target number

promo
- Promo to be sent 

transaction_id
- This is the identifier of the transaction being checked (this is part of the response of the Rewards API)

php's People

Contributors

glabsdev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

php's Issues

Sending texts to unsubscribed numbers

Is it possible to send text to unsubscribed numbers? It seems very tedious to do when you need to subscribe the numbers you wanted to send the text message. Is there any way to automatically subscribe them? There are too many steps in subscribing a number like you need some token and I observed that every number has a unique access_token? Correct me if I'm wrong. Anyways, please leave a guide if someone know. Thanks

Can't receive verification code with SMART/TNT mobile number

I can't receive any verification code to subscribe my number to my created app. Only Globe/TM numbers I tried is successfully received a code this time with my new project. I am using a free credit of 1000 only. I have tried already this year with my last project and it works with any network.

Getting access token always return invalid code

Getting access token always return

{"error":"Invalid code"}

This is the snippet of my code

$url = 'https://developer.globelabs.com.ph/oauth/access_token?app_id='.APP_ID.'&app_secret='.APP_SECRET.'&code='.SHORTCODE;
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}

Can't send message and no errors.

$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;
}

I got JSON parse error when sending SMS

I used curl in accessing the api. I based it in your docs which is something like this

curl -X POST
"https://devapi.globelabs.com.ph/smsmessaging/v1/outbound/1234/requests?access_token=3YM8xurK_IPdhvX4OUWXQljcHTIPgQDdTESLXDIes4g" -H "Content-Type: application/json" -d
{"outboundSMSMessageRequest": {
   "clientCorrelator": "123456",
   "senderAddress": "1234",
   "outboundSMSTextMessage": {"message": "Hello World"},
   "address": "9171234567"
 }
}

I followed it in php curl and only using REQUIRED parameters by

$ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, "https://devapi.globelabs.com.ph/smsmessaging/v1/outbound/$senderAddress/requests?access_token=$access_token");
        curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
        curl_setopt($ch, CURLOPT_POST,1 );
        curl_setopt($ch, CURLOPT_HTTPHEADER, array(
            'Content-Type: application/json',
        ));
        $postData = [
            'address' => '+639270277397',
            'message' => 'Hello from API'
        ];
        curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);

        $result=curl_exec ($ch);
        dd($result);

What am i getting is "{"detail":"JSON parse error - Expecting value: line 1 column 1 (char 0)"}"

Can someone tell me what is wrong? Pls correct me.

LBS: { "error": "No location result" }

Has anyone tried the location based service? I keep getting this result { "error": "No location result" } whenever I try to access the GPS of my subscribed mobile numbers. Btw, I'm using the sample code on PHP.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.