Example #1
0
 protected function LoadRemote()
 {
     if (TryGetParam('url', $url)) {
         $source = GetUrlContent($url);
         $this->data['source'] = $source;
         //$this->data['json'] = $this->GetJson($source);
     }
 }
Example #2
0
 protected function LoadRemote()
 {
     if (TryGetParam('id', $id)) {
         $html = GetUrlContent("http://www.iqiyi.com/v_{$id}.html");
         $count = preg_match_all('/\\"vid\\":\\"([0-9a-z]+)\\"/s', $html, $matchs);
         if ($count) {
             $vid = $matchs[1][0];
             $this->data = array();
             $this->data['url'] = "http://player.video.qiyi.com/{$vid}/0/0/v_{$id}.swf";
         }
     }
 }
Example #3
0
    }
    protected function LoadData()
    {
        $this->LoadRemote();
    }
    public function GetData($callback = null)
    {
        $data = json_encode($this->data);
        if (is_null($callback)) {
            return $data;
        } else {
            return "{$callback}({$data})";
        }
    }
    protected abstract function LoadRemote();
}
if (TryGetParam('service', $service)) {
    $service = strtolower($service);
    $apifile = "api/{$service}.php";
    if (file_exists($apifile)) {
        include $apifile;
        $api = new $service();
        if (TryGetParam('callback', $callback)) {
            header('Content-type:text/javascript');
            echo $api->GetData($callback);
        } else {
            header('Content-type:application/json');
            echo $api->GetData();
        }
    }
}