Posts Tagged ‘api’
PHP Viddler API Client – Forked
Okay that title sounds either a bit naughty or nasty, it’s neither. I forked the official PHP Viddler API wrapper and wrote a new one. Why? Well because when I worked there I wrote smaller client which worked out well for me so I’ve decided to release it.
If you strip out the comments from the new client, it’s less than 200 lines of code. Now I just focused on the core API, I didn’t add any of the add-on methods for embeds, oembed, etc. If you are looking for those I would suggest using the original Viddler client. I wanted to keep this lightweight, I may add it later on as an extension so if you want to use it you can, but for now, just keeping it simple.
So how did I strip so much out of the original? I used no 3rd party classes. I used only what is in PHP. I ditched the xmlparser.php file and went with SimpleXML. I also didn’t write a method for every for every possible API method. Actually I didn’t write one for any of them. I took advantage of PHP’s magic method __call(). Which is automatically called when the user calls an object method that doesn’t exist.
$viddler = new Viddler('API KEY');
$res = $viddler->user_auth(array(
'user' => 'USERNAME'
'password' => 'YOUR PASS'
));
CONTINUE READING | TWEET THIS | COMMENT (1)
