2
我已經使用CURL腳本登錄到提供免費流媒體的頁面,然後使用CURL我將選擇要觀看的流的子頁面。Embebed播放器無法連接到網絡 - CURL
當腳本通過本地主機(我使用xampp)運行時,一切正常,但是當我把它放在我的web服務器上時,它說它無法連接到網絡。唯一看起來不同的是cookie,在Web服務器上它沒有新行/ n。一切都在一條線上。
如何處理?這是我的課,我使用與網頁連接:
class openTV {
public $channel;
function __construct($channel) {
$this -> channel = $channel;
}
function openChannel() {
$login_email = '[email protected]';
$login_pass = 'pass';
$fp = fopen("cookie.txt", "w");
fclose($fp);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://strona/user/login');
curl_setopt($ch, CURLOPT_POSTFIELDS,'email='.urlencode($login_email).'&password='.urlencode($login_pass));
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
curl_setopt($ch, CURLOPT_COOKIEFILE, 'cookie.txt');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.3");
curl_setopt($ch, CURLOPT_REFERER, "http://strona/user/login");
$page = curl_exec($ch);
curl_setopt($ch, CURLOPT_URL, $this->channel);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.3");
curl_setopt($ch, CURLOPT_REFERER, $this->channel);
curl_setopt($ch, CURLOPT_COOKIEFILE, 'cookie.txt');
curl_setopt($ch, CURLOPT_POST, 0);
$info = curl_getinfo ($ch);
$page = curl_exec($ch);
preg_match('/session_token=\[[a-zA-Z0-9]{8}\]/', $page, $matches);
$return['token'] = substr($matches[0], 31, 8);
preg_match('/<object(.*)>[.\s\S]*<\/object>/', $page, $matches);
$return['player'] = $matches[0];
//$return['player'] = $page;
$return['channel'] = $this->channel;
return $return;
}
}
那麼,我把那裏'strona'作爲例子,原來有http://www.wlacz.tv但仍然沒有工作。但通過本地主機完美工作。 – b4rt3kk
@ user1648759比它的網絡問題 – Vyktor
你是什麼意思Vyktor?有沒有什麼辦法解決這一問題? – b4rt3kk