I am trying to get video source URL from URLs like this one:
http://www.streamuj.tv/video/4a95f29bafc661c688a6?remote=1
I want to get this url:
http://s2.streamuj.tv:8080/vid/01c5cbf5cb2893dcba25518aa7fd84b2/58d669ce/4a95f29bafc661c688a6_sd.flv?start=0
A have tried to use CURL, but it hasn't helped yet.
Here is my code with CURL:
<?php
session_start();
include "simple_html_dom.php";
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, 'http://www.streamuj.tv/video/4a95f29bafc661c688a6?streamuj=original&authorize=ac13bb77d3d863ca362315b9b4dcdf3e');
curl_setopt($curl, CURLOPT_FILETIME, true);
curl_setopt($curl, CURLOPT_NOBODY, true);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HEADER, true);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, TRUE);
curl_setopt($curl, CURLOPT_PROXY, "189.3.93.114:8080");
curl_setopt($curl, CURLOPT_HTTPHEADER, array( 'user-agent:Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2950.0 Iron Safari/537.36' ));
$header = curl_exec($curl);
$info = curl_getinfo($curl);
curl_close($curl);
echo $info['url'];
// print "http://www.streamuj.tv/video/4a95f29bafc661c688a6?streamuj=original&authorize=ac13bb77d3d863ca362315b9b4dcdf3e"
?>
Any solutions using PHP or Python? Thanks!
Related
I tried getting the cookie file from logging into the site binweevils, but i am unable to do so.
I have entered the correct values to be posted to the API, but for some reason it is telling me to enable cookies.
function login() {
$curl = curl_init("http://lb.binweevils.com/php2/login/logUserIn.php");
curl_setopt($curl, CURLOPT_POST, true);
define('USER_AGENT', 'Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.2309.372 Safari/537.36');
curl_setopt($curl, CURLOPT_USERAGENT, USER_AGENT);
curl_setopt($curl, CURLOPT_POSTFIELDS, "userID="."mo_salah"."&password="."test"."&rememberMe=1&submitted=1&x=".mt_rand(1, 200)."&y=".mt_rand(1, 100));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HEADER, true);
curl_setopt($curl, CURLOPT_COOKIEJAR, "sitecookies.txt");
$header = curl_exec($curl);
curl_close($curl);
print($header);
if(preg_match('/http:\/\/play\.binweevils.com\?res\=(.*?)\n/', $header))
return false;
return true;
}
If anyone can help me with this, it will be deeply appreciated.
The point : is to get cookies from this website.
I'm trying to parse a website with curl.
However the first screen is a empty form.
So far I'm getting an error (301-302)
Here is my code:
<?php
$url = "https://www.interiorhealth.ca/HedgehogPortal/?returnUrl=/HedgehogPortal/facility/Table";
$url_redirect = "https://www.interiorhealth.ca/HedgehogPortal/facility/Table";
define('USER_AGENT', 'Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.2309.372 Safari/537.36');
define('COOKIE_FILE', 'cookie.txt');
define('FORM_URL', $url);
define('REDIRECT_URL', $url_redirect);
$postValues = array();
//Initiate cURL.
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, REDIRECT_URL);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($postValues));
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_COOKIEJAR, COOKIE_FILE);
curl_setopt($curl, CURLOPT_USERAGENT, USER_AGENT);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_REFERER, FORM_URL);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, false);
$server_output = curl_exec($curl);
//Check for errors!
if(curl_errno($curl)){
throw new Exception(curl_error($curl));
} else {
echo $server_output;
}
?>
Any help or pointers would be gladly appreciated.
Thank you!
I have a simple GET request that I am trying to make and get the results back. I have tried it in Postman without any headers or body and it works just fine. I have even put it in my browser and it returns a good result. But, when I do it in PHP I am not getting anything. This is what my code looks like. What am I doing wrong?
$curl = curl_init();
curl_setopt($curl,CURLOPT_URL,'http://********/vizportal/api/web/v1/auth/kerberosLogin');
curl_setopt($curl,CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_POST, 0);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, '20');
$resp = curl_exec($curl);
echo $resp;
use this header to send header like browser to server :
$curl = curl_init('http://********/vizportal/api/web/v1/auth/kerberosLogin');
curl_setopt($curl, CURLOPT_POST, 0);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, '20');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
// curl_setopt($curl, CURLOPT_HEADER, true);
// curl_setopt($curl, CURLINFO_HEADER_OUT, true); // enable tracking
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
'Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
'Accept-Encoding:gzip, deflate, sdch',
'Accept-Language:en-US,en;q=0.6',
'Cache-Control:max-age=0',
'Connection:keep-alive',
'Host:www.********.tld ', // for example : www.google.com
'Referer: http://********/vizportal/api/web/v1/auth/kerberosLogin',
'Upgrade-Insecure-Requests:1',
'User-Agent:Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.106 Safari/537.36',
));
$response = curl_exec($curl);
curl_close($curl);
I have script for video player
<?php
$id = 35719350987;
$url = 'http://ok.ru/dk?cmd=videoPlayerMetadata&mid='.$id;
$ch = curl_init();
curl_setopt($ch, CURLOPT_COOKIE, 'viewport=1040; _flashVersion=1');
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json','Accept: *'));
curl_setopt($ch, CURLOPT_USERAGENT,$_SERVER['HTTP_USER_AGENT']);
curl_setopt($ch, CURLOPT_REFERER, 'ok.ru/videoembed/'.$id);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
#curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
$html = curl_exec($ch);
$json = json_decode($html);
?>
The output of browser chrome is
callbackFunc([ {file:"........"video/mp4"}])
Is work
But when i use mobile is not work
When from mobile json need to take [{"name":"mobile","url":"....} , from
http://www.ok.ru/dk?cmd=videoPlayerMetadata&mid=35719350987 but is not take nothing
This line does not work curl_setopt($ch, CURLOPT_USERAGENT,$_SERVER['HTTP_USER_AGENT']); instead curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.93 Safari/537.3 Mobile'); but it does not work in mobile browsers
i have problem that the "PHP" cURL function don't save the cookie !
curl function :
$file['cookie'] = "cooki";
function cURL_Page($url='',$var=''){
global $file;
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT,20);
curl_setopt($curl, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.64 Safari/537.31');
curl_setopt($curl, CURLOPT_REFERER, "http://www.libertyreserve.com/en/login");
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
if($var) {
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $var);
}
curl_setopt($curl, CURLOPT_COOKIE,$file['cookie']);
curl_setopt($curl, CURLOPT_COOKIEFILE,$file['cookie']);
curl_setopt($curl, CURLOPT_COOKIEJAR,$file['cookie']);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 3);
curl_setopt($curl, CURLOPT_HEADER, 0);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
$result = curl_exec($curl);
curl_close($curl);
return $result;
}
in the file "cooki" the are no results
p.s : i curl a https page
thanks all