Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * Getting direct vidoza URL
- * using node-urlresolver-api API by @lscofield
- * This script is only tested with vidoza links
- */
- // vidoza test url
- // You can test with another link if this link go down
- $url = 'https://vidoza.net/x1l6wnmde215.html';
- // Create curl instance (GET)
- $ch = curl_init();
- //Set the URL that you want to GET by using the CURLOPT_URL option.
- curl_setopt($ch, CURLOPT_URL, $url);
- //Set CURLOPT_RETURNTRANSFER so that the content is returned as a variable.
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- //Set CURLOPT_FOLLOWLOCATION to false to follow redirects.
- curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false);
- // Set referer for mixdrop request
- curl_setopt($ch, CURLOPT_REFERER, $url);
- //Execute the request.
- $html = curl_exec($ch);
- //Close the cURL handle.
- curl_close($ch);
- // Encode the html code to base64
- $html = base64_encode($html);
- $host = "vidoza"; // in this case
- $api_endpoint = "http://yourdomain/api/v1/$host";
- // Prepare POST params
- // Prepare auth param
- $auth = '{"auth":"","skk":"your_app_key_from_config"}';
- // Encode auth to base64
- $auth = base64_encode($auth);
- $params = array(
- "source" => $html,
- "auth" => $auth
- );
- $params = json_encode($params);
- // Create curl instance (POST) to get direct
- // URL with API
- $ch = curl_init($api_endpoint);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($ch, CURLINFO_HEADER_OUT, true);
- curl_setopt($ch, CURLOPT_POST, true);
- curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
- // Set HTTP Header for POST request
- curl_setopt(
- $ch,
- CURLOPT_HTTPHEADER,
- array(
- 'Content-Type: application/json',
- 'Content-Length: ' . strlen($params)
- )
- );
- // Submit the POST request
- $result = curl_exec($ch);
- // Close cURL session handle
- curl_close($ch);
- if ($result) {
- // Convert to json
- $result = json_decode($result);
- // Print direct url (format: .mp4 or .m3u8)
- // player to be play in
- // the media player
- echo $result->url;
- // Note if the app_key set in post auth
- // not match with the app_key that you
- // has in your server config file
- // $resul->url will have a random troll mp4 video
- // If vidoza url is down $result->url will have empty string
- } else {
- // No data fetched
- // Typically API or SERVER issue
- }
Add Comment
Please, Sign In to add comment