Alltube\VideoDownload::getJSON PHP Method

getJSON() public method

Get all information about a video.
public getJSON ( string $url, string $format = null ) : object
$url string URL of page
$format string Format to use for the video
return object Decoded JSON
    public function getJSON($url, $format = null)
    {
        return json_decode($this->getProp($url, $format, 'dump-json'));
    }

Usage Example

Example #1
0
 /**
  * Output JSON info about the video.
  *
  * @param Request  $request  PSR-7 request
  * @param Response $response PSR-7 response
  *
  * @return Response HTTP response
  */
 public function json(Request $request, Response $response)
 {
     $params = $request->getQueryParams();
     if (isset($params['url'])) {
         try {
             $video = $this->download->getJSON($params['url']);
             return $response->withJson($video);
         } catch (\Exception $e) {
             return $response->withJson(['success' => false, 'error' => $e->getMessage()]);
         }
     }
 }
All Usage Examples Of Alltube\VideoDownload::getJSON