如何查找登录凭据发送到的 URL

How to find the url where login credentials are send to?

本文关键字:URL 登录 何查找 查找      更新时间:2023-09-26
使用

PHP/cURL,我尝试使用我的凭据登录到 www.teliatv.dk 并从域上的文件中返回一些 json,同时通过将会话 cookie 存储在 txt 文件中来保持会话活动状态。

<?php
// Login to www.teliatv.dk
$username = "xxxxxxx";
$password = "xxxxxxxx";
$file = dirname(__FILE__) . "cookie.txt";
$ch = curl_init("http://www.teliatv.dk/");
curl_setopt($ch, CURLOPT_COOKIEFILE, $file);
curl_setopt($ch, CURLOPT_COOKIEJAR, $file);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_COOKIESESSION, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_USERPWD, "$username:$password");
echo curl_exec ($ch);
curl_close($ch);
// Display content of cookie.txt
echo file_get_contents($file);
// Retrieve json content
$ch = curl_init("https://www.teliatv.dk/rest/secure/livechannels/2087/decryptionticket_postasget?deviceType=WEB&callback=jQuery161003904806077480316_1421055449439&_=1421055849886");
curl_setopt($ch, CURLOPT_COOKIEFILE, $file);
curl_setopt($ch, CURLOPT_COOKIEJAR, $file);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
echo curl_exec ($ch);
curl_close($ch);
?>

但是,我的脚本似乎无法首先登录到该站点。

站点上登录表单中的操作属性为空,并且提交表单时 HTTPheader 不会显示 URL。

显然,该网站使用嵌入式JavaScript(EJS),因此生成网站的HTML内容(我不熟悉)。我不知道这是否是我找不到发送用户名和密码的 URL 的原因?

我希望有人能够帮助我。

看起来您正在发送 GET 请求。登录内容大部分时间都使用 POST 请求。您还可以在第一次请求后查看服务器的答案:它可能包含可以帮助您的消息或错误。

祝你好运!