[英]send a ajax GET request to a https website with username and password
我想訪問一個網站並使用“ajax調用”從中獲取錨標簽,如下所示:
$.ajax({
url: 'https://www.facebook.com/',
type: 'GET',
success: function(res) {
var headline = $(res.responseText).find('a').text();
alert(headline);
}
});
但我的標題是空白的。 但是我在“http”網站上嘗試了相同的代碼,它工作正常。
這是因為https
與http
不同,Facebook 就像許多其他網站一樣使用 cookie 進行身份驗證。 您必須首先在https://facebook.com
進行身份驗證,然后才能取回數據。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.