Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/florindumitru/stackmobphp
PHP class to connect to StackMob API
https://github.com/florindumitru/stackmobphp
Last synced: about 18 hours ago
JSON representation
PHP class to connect to StackMob API
- Host: GitHub
- URL: https://github.com/florindumitru/stackmobphp
- Owner: florindumitru
- Created: 2014-02-22T00:02:47.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2012-04-18T17:48:29.000Z (over 12 years ago)
- Last Synced: 2024-10-12T20:34:59.166Z (about 1 month ago)
- Language: PHP
- Size: 102 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README
Awesome Lists containing this project
README
This is a simple PHP class to connect to StackMob APIs
How to use:
1) Configure variables
please change
YOUR-CONSUMER-KEY
YOUR-CONSUMER-SECRET
YOURAPPwith values you can find here: https://www.stackmob.com/platform/account/apps/reset
define('CONSUMER_KEY', 'YOUR-CONSUMER-KEY');
define('CONSUMER_SECRET', 'YOUR-CONSUMER-SECRET');define('API_URL_GET', 'http://api.mob1.stackmob.com/api/0/YOURAPP');
define('API_URL_PUT', 'http://api.mob1.stackmob.com');
define('API_URL_POST', 'http://api.mob1.stackmob.com/api/0/YOURAPP');
define('API_URL_DELETE', 'http://api.mob1.stackmob.com/api/0/YOURAPP');2) Test CRUD
we suppose you already created a dumb schema ("dumb") in your stackmob interface with dumb_id and name.
put('dumb'); //all dumb list
$response = $SMConnector->put('dumb','dumb_unique_id'); //ony dumb_unique_id objectPOST:
$obj = array();
$obj[dumb_id]='dumb_unique_id';
$obj[name]='awesome_dumb_name';$response = $SMConnector->post('dumb',$obj);
PUT:
$obj = array();
$obj[dumb_id]='dumb_unique_id';
$obj[name]='awesome_dumb_name';$response = $SMConnector->put('dumb',$obj);
DELETE:
$response = $SMConnector->delete('dumb','dumb_object_to_delete'); //to delete the object dumb_object_to_delete
enjoy!