RMENDES Posted September 25, 2015 Share Posted September 25, 2015 Hello Everybody,I try to use WinHTTP functions to read a page and click in a href="javascript".But, i think in the especific webpage has a javascript to block a AUTOIT.Could you help-me?I try use the tutorials code, and isnt workTake a lookthe website is (fastshop.com.br)#include "WinHttp.au3" Opt("MustDeclareVars", 1) ; Initialize and get session handle Global $hOpen = _WinHttpOpen() ; Get connection handle Global $hConnect = _WinHttpConnect($hOpen, "fastshop.com.br") ; Request Global $hRequest = _WinHttpSimpleSendRequest($hConnect) ; Simple-read... Global $sRead = _WinHttpSimpleReadData($hRequest) MsgBox(64, "Returned (first 1100 characters)", StringLeft($sRead, 1100) & "...") ; Close handles _WinHttpCloseHandle($hRequest) _WinHttpCloseHandle($hConnect) _WinHttpCloseHandle($hOpen) Link to comment Share on other sites More sharing options...
trancexx Posted September 25, 2015 Share Posted September 25, 2015 What exactly do you get returned? ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
RMENDES Posted September 29, 2015 Author Share Posted September 29, 2015 i want to receive the HTML code of this page. but when i execute this script, i recieve only a javascript function like this<script type="text/javascript"> window.location.href = "http://www.fastshop.com.br/loja/" </script>but if you access the page, and view source, the code if very diferent.I think has a code in this page block autoit script. Link to comment Share on other sites More sharing options...
trancexx Posted September 29, 2015 Share Posted September 29, 2015 Nothing is blocked. What you see is javascript redirection. Resourceful programmer would do this:#include "WinHttp.au3" ; Initialize and get session handle $hOpen = _WinHttpOpen() ; Get connection handle $hConnect = _WinHttpConnect($hOpen, "fastshop.com.br") ; Request $hRequest = _WinHttpSimpleSendRequest($hConnect, Default, "/loja") ; Simple-read... $sRead = _WinHttpSimpleReadData($hRequest) MsgBox(64, "Returned (first 1100 characters)", StringLeft($sRead, 1100) & "...") ; Close handles _WinHttpCloseHandle($hRequest) _WinHttpCloseHandle($hConnect) _WinHttpCloseHandle($hOpen) ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
RMENDES Posted October 16, 2015 Author Share Posted October 16, 2015 Thankyou for your answer. Now its work fine! grats.Now, in this page, have a link to other page, but this link is a javascript.How i can call this javascript to reload a products ?This is a link http://www.fastshop.com.br/loja/tv-e-videoThis is a javascript linkjavascript:dojo.publish("showResultsForPageNumber",[{pageNumber:"2",pageSize:"12", linkId:"WC_SearchBasedNavigationResults_pagination_link_2_categoryResults_bottom"}])Sorry about my bad english Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now