Jump to content

WinHTTP cant read a especific page


Recommended Posts

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)

 

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.

 

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

Link to post
Share on other sites
  • 3 weeks later...

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

 

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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...