Ejemplo n.º 1
0
function sendRequest($request)
{
    //esta funcion ace toa la peticion, solo le pasamos el metodo a ejecutar
    $params = array('output' => 'json', 'data' => $request);
    $resp = RedTubeApiCall('http://api.redtube.com/', $params);
    return $resp;
}
Ejemplo n.º 2
0
function getRedtubeVideos($page = 0, $category = false)
{
    $http = 'http://api.redtube.com/';
    $call = 'redtube.Videos.searchVideos';
    $params = array('output' => 'json', 'data' => $call, 'page' => $page, 'search' => 'holly');
    if ($category) {
        $params['category'] = $category;
    }
    $response = RedTubeApiCall($http, $params);
    if ($response) {
        $json = json_decode($response);
        if (isset($json->code) && isset($json->message)) {
            throw new Exception($json->message, $json->code);
        }
        return $json;
    }
    return false;
}