smsglobal / rest-api-client-php Goto Github PK
View Code? Open in Web Editor NEWDEPRECATED -- A wrapper for the SMSGlobal REST API in PHP
Home Page: http://www.smsglobal.com/
License: MIT License
DEPRECATED -- A wrapper for the SMSGlobal REST API in PHP
Home Page: http://www.smsglobal.com/
License: MIT License
I am creating contact using following code.
$newc = new Contact;
$newc->setDisplayName('Ashish10');
$newc->setFamilyName('Namdeo10');
$newc->setGivenName('AKN11');
$newc->setEmailAddress('[email protected]');
$newc->setGroup(451121);
$newc->setMsisdn('919891xxxxxx');
$rest->save($newc);
But its throwing Internal Server Error on smsglobal script.
[content:protected] => {"error":"Undefined index: group on line 37 in /var/www/api/rest-api/src/Rest/Resource/Field/Validator/Unique.php"}
[handle:protected] => Resource id #2
[headers:protected] => HTTP/1.0 500 Internal Server Error
Is this issue in client script or on smsglobal script.
While trying to post a new sms message, i was relying on returning $sms->getId(), as per your example in the README.md, but it was coming back as 0.
After a little investigation (read: hours of var_dumps), i noticed a few issues with the way the id was being extracted from the response.
File: Smsglobal/RestApiClient/RestApiClient.php
Line: 250
$id = (int) substr($id, strrpos('/', $id) + 1, -1);
The first issue is that the arguments for the function strrpos
are in the wrong order. It should be strrpos($id, '/')
(see php.net/strrpos).
Secondly, the final parameter (-1
) is unnecessary as the trailing slash is already removed on line 248. (Alternatively, you could use rtrim($id, '/')
to achieve the same result there)
The resulting code for line 250 should look like this:
$id = (int) substr($id, strrpos($id, '/') + 1);
P.S. Thank you for providing this library, it made it a whole lot easier to get started with the API :)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.