2016-07-27 35 views
0

我做了一個腳本,使用curl登錄頁面,然後檢索頁面。它部分起作用:它不顯示整個頁面。該頁面有一些帶有影子DOM內容的iframe。我怎樣才能計算頁面的這些部分?有沒有辦法來檢索這個隱藏的代碼? 這是我運行的命令:捲曲檢索頁面沒有陰影dom

curl "https://example.com/portal/default.aspx" -H "Cookie: ASP.NET_SessionId=xxxxxxxxxxxxxxxxxxxxxxxx; DefaultPage=login.aspx" -H "Origin: https://example.com" -H "Accept-Encoding: gzip, deflate, br" -H "Accept-Language: en-EN,en;q=0.8,en-US;q=0.6,en;q=0.4,pt;q=0.2" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36" -H "Content-Type: application/x-www-form-urlencoded" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8" -H "Cache-Control: max-age=0" -H "Referer: https://example.com/portal/login.aspx" -H "Connection: keep-alive" --data "IdLogin=user&IdPwd=&IdPwdCript=[2!>]h88RA/-VMen30:V]&ReturnTo=https://example.com/portal/" -o result.txt 

在此先感謝!

回答

1

內聯框架由瀏覽器呈現,並且cURL根本沒有呈現引擎。

嘗試SeleniumPhantomJS。我認爲你想要腳本與網站的交互,所以你可以找到許多語言的這些工具周圍的包裝。

對於PHP你可以試試Mink。它有Selenium或PhantomJS的驅動程序。

+0

你知道的東西,可以幫我到服務器端(Python或PHP)? – DarkSkull

+1

您可以嘗試[水貂(http://mink.behat.org/en/latest/)爲PHP。它有Selenium或PhantomJS的驅動程序。 –