RMENDES

WinHTTP cant read a especific page

5 posts in this topic

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 work

Take a look

the 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)

 

Share this post


Link to post
Share on other sites



What exactly do you get returned?


♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

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.

 

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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-video

This is a javascript link

javascript:dojo.publish("showResultsForPageNumber",[{pageNumber:"2",pageSize:"12", linkId:"WC_SearchBasedNavigationResults_pagination_link_2_categoryResults_bottom"}])

Sorry about my bad english

 

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now