Jump to content

Cookie Issue I think


Recommended Posts

I'm trying to get the service tag information from dell. My only problem is cookie's, I think. I can log in and pull the information just fine via the url from a browser window that I am already loged into the site. Um, any help would be great. Here is my code:

$ScriptConfig = @ScriptDir & "\config.ini"

$A = IniRead($ScriptConfig, "BASIC-CONFIG", "SERVICETAG-SOURCE", @ScriptDir & "\Servicetag.txt")
$B = IniRead($ScriptConfig, "BASIC-CONFIG", "FILE-DOWNLOAD-DIR", @ScriptDir & "\Servicetag")
$C = 1
$D = 1

If Not FileExists($A) Then
    $C = 2
EndIf

While $C = 2
    MsgBox(0, "Error Opening Service Tag Source", "Unalbe to locate: " & $A)
    Exit
WEnd

If Not FileExists($B) Then
    DirCreate($B)
EndIf

While 1
    $E = FileReadLine($A, $D)
    If @error = -1 Then ExitLoop
    
    $F = StringTrimLeft($E, 2)
    $G = InetGet("https://warrantypartsdirect.dell.com/us/members/SP120000.asp?SvcTag=" & $F, $B & "\" & $F & ".html", 1, 0)
    $D = $D + 1
WEnd

[quote] Gilbertson's Law: Nothing is foolproof to a sufficiently talented fool.Sandro Alvares: Flaxcrack is please not noob! i can report you is stop stupid. The Post[/quote]I made this: FWD & MD5PWD()

Link to comment
Share on other sites

I'm trying to get the service tag information from dell. My only problem is cookie's, I think. I can log in and pull the information just fine via the url from a browser window that I am already loged into the site. Um, any help would be great. Here is my code:

$ScriptConfig = @ScriptDir & "\config.ini"

$A = IniRead($ScriptConfig, "BASIC-CONFIG", "SERVICETAG-SOURCE", @ScriptDir & "\Servicetag.txt")
$B = IniRead($ScriptConfig, "BASIC-CONFIG", "FILE-DOWNLOAD-DIR", @ScriptDir & "\Servicetag")
$C = 1
$D = 1

If Not FileExists($A) Then
    $C = 2
EndIf

While $C = 2
    MsgBox(0, "Error Opening Service Tag Source", "Unalbe to locate: " & $A)
    Exit
WEnd

If Not FileExists($B) Then
    DirCreate($B)
EndIf

While 1
    $E = FileReadLine($A, $D)
    If @error = -1 Then ExitLoop
    
    $F = StringTrimLeft($E, 2)
    $G = InetGet("https://warrantypartsdirect.dell.com/us/members/SP120000.asp?SvcTag=" & $F, $B & "\" & $F & ".html", 1, 0)
    $D = $D + 1
WEnd
actually i think the easiest way to do what you want, is to use IE.au3 you can create a browser window, send it where you want, log in and submit the login form, and just grab the data right out of the browser, rather than using inetget. all of that can be done in the background too.
Link to comment
Share on other sites

You answered your question I think when you said "log in". If a log in is required the an IE session cookie would not work from another application. The site may not even set login informatiom in a cookie and operate from a session ID only. Regardless you must submit your login info from within your code to gain access to many network resources. If looking at the sites login page and emulating the procedure they use, cgi, java,whatever is too complicated then flaxcracks suggestion is your best bet.

Link to comment
Share on other sites

actually i think the easiest way to do what you want, is to use IE.au3 you can create a browser window, send it where you want, log in and submit the login form, and just grab the data right out of the browser, rather than using inetget. all of that can be done in the background too.

cameronsdad,

I like the idea; however, I have no IE.au3 in my include folder. Is there some other place it would be and is there some where I can find the functions of IE.au3? Please advise.

[quote] Gilbertson's Law: Nothing is foolproof to a sufficiently talented fool.Sandro Alvares: Flaxcrack is please not noob! i can report you is stop stupid. The Post[/quote]I made this: FWD & MD5PWD()

Link to comment
Share on other sites

You answered your question I think when you said "log in". If a log in is required the an IE session cookie would not work from another application. The site may not even set login informatiom in a cookie and operate from a session ID only. Regardless you must submit your login info from within your code to gain access to many network resources. If looking at the sites login page and emulating the procedure they use, cgi, java,whatever is too complicated then flaxcracks suggestion is your best bet.

Do you mean cameronsdad suggestion? Thanks.

[quote] Gilbertson's Law: Nothing is foolproof to a sufficiently talented fool.Sandro Alvares: Flaxcrack is please not noob! i can report you is stop stupid. The Post[/quote]I made this: FWD & MD5PWD()

Link to comment
Share on other sites

You can get IE.au3 from this page

http://www.autoitscript.com/forum/index.ph...13398&hl=IE.au3

Bottom of the 1st post...

yeah, that's an great set of UDF's, it's very well documented, and if you DO run into any issues, several people on these forum use it enough to help with most issues, and the author (dale) is also pretty active on the forums also, and can answer the tough stuff
Link to comment
Share on other sites

You can get IE.au3 from this page

http://www.autoitscript.com/forum/index.ph...13398&hl=IE.au3

Bottom of the 1st post...

WOW! This looks nice! I can't wait to try it. Is there any other great stuff like this that I don't know about?

[quote] Gilbertson's Law: Nothing is foolproof to a sufficiently talented fool.Sandro Alvares: Flaxcrack is please not noob! i can report you is stop stupid. The Post[/quote]I made this: FWD & MD5PWD()

Link to comment
Share on other sites

yeah, that's an great set of UDF's, it's very well documented, and if you DO run into any issues, several people on these forum use it enough to help with most issues, and the author (dale) is also pretty active on the forums also, and can answer the tough stuff

#include <IE.au3>
$oIE = _IECreate()
_IENavigate($oIE, "https://warrantypartsdirect.dell.com/us/Program/index.asp")
$o_form = _IEFormGetObjByName($oIE, "0")
MsgBox(0,"stop1", "Stop1")
$o_login = _IEFormElementGetObjByName($o_form, "TechID", 0)
MsgBox(0,"stop2", "Stop2")
$o_password = _IEFormElementGetObjByName($o_form, "PIN", 0)
MsgBox(0,"stop3", "Stop3")
_IEFormElementSetValue($o_login, "test")
MsgBox(0,"stop4", "Stop4")
_IEFormElementSetValue($o_password, "test")
MsgBox(0,"stop5", "Stop5")
_IEFormSubmit($o_form)
>"C:\Program Files\AutoIt3\SciTe\CompileAU3\CompileAU3.exe" /run /beta /ErrorStdOut /in "C:\Documents and Settings\me\Desktop\New AutoIt v3 Script.au3" /autoit3dir "C:\Program Files\AutoIt3\beta" /UserParams 
>Running AU3Check...C:\Program Files\AutoIt3\SciTe\Defs\Unstable\Au3Check\au3check.dat
>AU3Check Ended. No Error(s).
>Running: (3.1.1.98):C:\Program Files\AutoIt3\beta\autoit3.exe "C:\Documents and Settings\me\Desktop\New AutoIt v3 Script.au3"  
C:\Program Files\AutoIt3\beta\Include\IE.au3 (848) : ==> Variable must be of type "Object".: 
If IsObj($o_object.elements.item ($s_name, $i_index)) Then 
If IsObj($o_object^ ERROR
>AutoIT3.exe ended.
>Exit code: 0   Time: 9.581

[quote] Gilbertson's Law: Nothing is foolproof to a sufficiently talented fool.Sandro Alvares: Flaxcrack is please not noob! i can report you is stop stupid. The Post[/quote]I made this: FWD & MD5PWD()

Link to comment
Share on other sites

I upgraded my beta version. It is now: >Running: (3.1.1.101)

Fixed it! I had to remove the quotes! $o_form = _IEFormGetObjByName($oIE, 0)

[quote] Gilbertson's Law: Nothing is foolproof to a sufficiently talented fool.Sandro Alvares: Flaxcrack is please not noob! i can report you is stop stupid. The Post[/quote]I made this: FWD & MD5PWD()

Link to comment
Share on other sites

  • 9 months later...

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...