-
-
Save m1ch3lp3r3z/3c6ba23d5cee88cf4321 to your computer and use it in GitHub Desktop.
MobileRider api php client samples
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
define('APP_ROOT', realpath(dirname(__FILE__)) . '/'); | |
require APP_ROOT . 'vendor/autoload.php'; | |
use Mr\Api\Service; | |
$serv = new Service('xxxxxxxxxxx', 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', 'api.mobilerider.com'); | |
$channels = $serv->getChannels(); | |
print "Channels count is " . count($channels) . "\n"; | |
print "First channel name in the list is: '" . $channels[0]->name . "'\n"; | |
$channel = $serv->createChannel(array('name' => 'Channel Test [MR Dev from PHP client]')); | |
$channel->save(); | |
print "New channel ID is: " . $channel->id . "\n"; | |
$channels = $serv->getChannels(array('name__contains' => 'php', 'id__gt' => 1)); | |
print "Channels that contain `php` in name field and id greater than 1: " . count($channels) . "\n"; | |
$medias = $serv->getMedias(); | |
print "Medias count is " . count($medias) . "\n"; | |
print "First media name in the list is: '" . $medias[0]->title . "'\n"; | |
$media = $serv->createVODMedia(array( | |
'title' => 'Media Test [MR Dev from PHP client]', | |
'file' => 'http://techslides.com/demos/sample-videos/small.mp4', | |
// Assigning channel to media in creation | |
'channels' => array($channel->id) | |
)); | |
$media->save(); | |
print "New media ID is: " . $media->id . ', in status: ' . $media->status . "\n"; | |
$medias = $serv->getMedias(array('title__contains' => 'php', 'channel__name__contains' => 'test')); | |
print "Medias that contain `php` in title field and have at least one channel containing in the name field the word `test`: " . count($medias) . "\n"; | |
// Reload media to check channels | |
$media = $serv->getMedia($media->id); | |
print "Media new channel name is: '" . $media->channels[0]->name . "'\n"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment