Orbitus Posted July 13, 2007 Share Posted July 13, 2007 Hello, I am trying to make a program that will change cookie information so that I can change stores on the Lowes website. Could someone please point me in the right direction if I am way off as it doesnt seem to be working? I know its not right because the count it keeps getting back is for the regular 30092 store. Any assistance would be greatly appreciated! Thanks, Chris expandcollapse popup#include <INet.au3> #include <array.au3> $number = 'http://www.lowes.com/lowes/lkn?action=productList&Ne=8000&category=Outdoor+Structures+%26+Storage&N=0+5001849' MsgBox(0,"Rounder", _catCounts($number)) ;Dim $collectedCats[1] ;$msg = _INetGetSource2($number) ;ClipPut($msg) $err = @error If @error <> 0 then MsgBox(16,"Error","Error number is : " & $err) Else MsgBox(0,"Rounder","done") EndIf Func _roundUp($inputvar) If Int($inputvar) < $inputvar Then Return Number(Int($inputvar) + 1) Else Return Int($inputvar) EndIf EndFunc;==>roundup Func _catCounts($strURL) $strHtml = _INetGetSource($strURL) $strText = StringTrimLeft(StringMid($strHtml,StringInStr($strHtml,'<td class="tir thliteblu" colspan="3"><b class="txtwhite">'),65),58) Return int($strText) EndFunc;==>_catCounts ;=============================================================================== ; ; Function Name: _INetGetSource() ; Description: Gets the source from an URL without writing a temp file. ; Parameter(s): $s_URL = The URL of the site. ; Requirement(s): DllCall/Struct & WinInet.dll ; Return Value(s): On Success - Returns the source code. ; On Failure - 0 and sets @ERROR = 1 ; Author(s): Wouter van Kesteren. ; ;=============================================================================== Func _INetGetSource2($s_URL, $s_Header = '') If StringLeft($s_URL, 7) <> 'http://' And StringLeft($s_URL, 8) <> 'https://' Then $s_URL = 'http://' & $s_URL Local $h_DLL = DllOpen("wininet.dll") Local $ai_IRF, $s_Buf = '' Local $ai_IO = DllCall($h_DLL, 'int', 'InternetOpen', 'str', "AutoIt v3", 'int', 0, 'int', 0, 'int', 0, 'int', 0) If @error Or $ai_IO[0] = 0 Then DllClose($h_DLL) SetError(1) Return "" EndIf Local $ai_IO1 = DllCall($h_DLL, 'none', 'InternetSetCookie', 'str', "http://www.lowes.com", 'str','storeName' , 'str', 'LOWE%27S+OF+BURBANK%2C+CA') If @error Or $ai_IO1[0] = 0 Then DllClose($h_DLL) SetError(9) Return "" EndIf Local $ai_IO2 = DllCall($h_DLL, 'none', 'InternetSetCookie', 'str', "http://www.lowes.com", 'str','storeNbr' , 'str', '1144') If @error Or $ai_IO2[0] = 0 Then DllClose($h_DLL) SetError(9) Return "" EndIf Local $ai_IO3 = DllCall($h_DLL, 'none', 'InternetSetCookie', 'str', "http://www.lowes.com", 'str','shipToZip' , 'str', '90210') If @error Or $ai_IO3[0] = 0 Then DllClose($h_DLL) SetError(9) Return "" EndIf Local $ai_IOU = DllCall($h_DLL, 'int', 'InternetOpenUrl', 'int', $ai_IO[0], 'str', $s_URL, 'str', $s_Header, 'int', StringLen($s_Header), 'int', 0x80000000, 'int', 0) If @error Or $ai_IOU[0] = 0 Then DllCall($h_DLL, 'int', 'InternetCloseHandle', 'int', $ai_IO[0]) DllClose($h_DLL) SetError(1) Return "" EndIf Local $v_Struct = DllStructCreate('udword') DllStructSetData($v_Struct, 1, 1) While DllStructGetData($v_Struct, 1) <> 0 $ai_IRF = DllCall($h_DLL, 'int', 'InternetReadFile', 'int', $ai_IOU[0], 'str', '', 'int', 256, 'ptr', DllStructGetPtr($v_Struct)) $s_Buf &= StringLeft($ai_IRF[2], DllStructGetData($v_Struct, 1)) WEnd DllCall($h_DLL, 'int', 'InternetCloseHandle', 'int', $ai_IOU[0]) DllCall($h_DLL, 'int', 'InternetCloseHandle', 'int', $ai_IO[0]) DllClose($h_DLL) Return $s_Buf EndFunc ;==>_INetGetSource 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