Help with http request

Started by nickels, July 09, 2006, 11:35:55 PM

Previous topic - Next topic

nickels

I wonder if anyone can help here.

I currently have an Access database setup to download the ICE XML file using webget, and parse it using the ChilkatXml COM add in.

I have just noticed that this COM-addin has a "httpget" method, which is probably a better way of  getting the data rather than using shell webget.exe [address of xml file], as the shell command in VBA executes asynchronously and sometimes the file has not downloaded before I wish to proceed with the next program step.

Trouble is, I can plug in the http address but how do I put in user name and password without having to enter it at runtime? The documentation only has the parameters &start_date=<date>; · &end_date=<date> · &late_mod=<last modified time>; · &no_programs=1 etc. Are there other parameters that can be added to this cgi? (I think that it should be last_mod shouldn't it?)

Any help appreciated!

NICK

Russell at IceTV

Hi Nick,

Yes, it should indeed be "&last_mod=<last modified time>".  Definite typo there, we'll take care of it -- sorry about that.  There are also two more parameters missing from that page:

&days=<number of days>
&channels=<comma-delimited channel ID list>

The original documentation page is here:  http://iceguide.icetv.com.au/cgi-bin/epg/iceguide.cgi?op=help

But to answer your original question of how to include the username and password...  That's something that's specific to whatever program you're using to download the file.  Webget.exe allows you to add "-u <username" and "-p <password" to the command line.  But you'll have to find out how to include those parameters with your program.  What you're looking for is a way to authenticate directly with the web server through HTTP.  But I'm afraid I'm not familiar with that program so I'm not sure how to do it.

Good luck,
Russell

BJReplay

The standard form is
http://userid:password@www.anywhere.com/
Whether and how your component handles this is another issue.  If you build your URL and plug in your userid and password into it, internet explorer (for example) will handle the authentication correctly and you're away.

Russell at IceTV

Does that method still work in the latest versions of IE?  I'm pretty sure there was a Microsoft patch a couple of years back that disabled that, because of some security risk.  But it may still be the way third party programs do it, I'm not sure.

Russell

BJReplay

Hmmm, not sure.

Definitely still works with ftp in IE.

As far as I know it is part of the RFC: http://www.gbiv.com/protocols/uri/rfc/rfc3986.html#userinfo, although noted as deprecated.

nickels

#5
Thanks for that. I tried the http://username:password@iceguide... format using Firefox and it gets the file no worries. I'll plug it into my code in the next day or so and report back.

Cheers

NICK

EDIT 11/7

Yes, that worked in code as well: the httpget method of this com-addin is synchronous so the whole thing will work unattended if necessary.

I just checked the RFC for the URI: it appears that the usage username:password@domain is deprecated (for the obvious reason that in a get request the password would be visible to the user. That's not an issue for me as the user will never see the username or password.).