AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Using xpath to load XML data via HTTPS

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
bigsalgo911



Joined: 02 Jul 2008
Posts: 21

PostPosted: Thu Jul 03, 2008 9:50 pm    Post subject: Using xpath to load XML data via HTTPS Reply with quote

What I'm trying to do is load certain variables from a web based account access system in to an AHK script putting the variables where they need to go. I am using the following code to attempt to load the xml information:

Code:

xpath_load(xmlin, "https://xxx.yyy.com/main?cmd=display&user_cust_id=%ID%&raw=1")


the %ID% is user defined earlier in the script.

Then I have created a hotkey as follows:

Code:
F6::
{
cust_email := xpath(xml, "/root/cust_email/text()")
GuiControl,, Email2, %cust_email%
}return


However it never appears to load the xml data. Is there extra code I need to have since I'm trying to load the info via HTTPS or is that not the issue at all?

The XML document appears kinda like this:

Code:
  <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
- <root>
  <cust_blacklist>0</cust_blacklist>
  <cust_country>US</cust_country>
  <cust_email>email goes here</cust_email>
  <cust_first_date>03/06/2007 06:36:01 AM</cust_first_date>
  <cust_last_date>07/02/2008</cust_last_date>
  <cust_nickname>nickname</cust_nickname>


What am I doing wrong?
Back to top
View user's profile Send private message
Oberon



Joined: 18 Feb 2008
Posts: 458

PostPosted: Thu Jul 03, 2008 10:09 pm    Post subject: Reply with quote

Update to the latest version of xpath and try this:

Code:
tmp = %A_Temp%\x
URLDownloadToFile, https://xxx.yyy.com/main?cmd=display&user_cust_id=%ID%&raw=1, %tmp%
FileRead, xml, %tmp%
FileDelete, %tmp%

xpath_load(xml)
Return

F6::
cust_email := xpath(xml, "/root/cust_email/text()")
GuiControl, , Email2, %cust_email%
Return
Back to top
View user's profile Send private message
bigsalgo911



Joined: 02 Jul 2008
Posts: 21

PostPosted: Thu Jul 03, 2008 10:21 pm    Post subject: Reply with quote

OMG that was perfect. Genuis I tell you!

Anyway I can put a progress bar n my UI for that download?
Back to top
View user's profile Send private message
bigsalgo911



Joined: 02 Jul 2008
Posts: 21

PostPosted: Thu Jul 03, 2008 11:44 pm    Post subject: Reply with quote

lol nm I got it. Thank you SO much for that code. You may have gotten me a raise at work!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group