Link to home
Start Free TrialLog in
Avatar of museful
museful

asked on

getURL and cookies

For some time, my PB10 app has happily been using a getURL call to retrieve HTML from a site.  Recently, a cookie is now required to access the same URL.  After permitting the cookie to be set, I can access the page in a browser, but how to provide the cookie info when accessing from PB?

Here is an example:

ls_URL = "http://www.tsnhorse.com/cgi-bin/instant.cgi?type=inc&country=USA&track=SA&date=2006-03-26"
getURL (ls_URL, this)

This used to work fine and return valid HTML to the data blob (i.e. as viewed in a browser), but now rather returns a page informing the necessity of registration, which simply places a cookie on the user computer.  After the cookie is placed, browsers work fine, but not the PB  app because, I presume, the cookie info needs to be passed.  How do I append the Cookie header item to the ls_URL value, so that it is treated during the HTTP GET as a separate Request Header item, and not part of the  main Request-line?

Example cookie info is: Cookie: EMREG=myname@mydomain.com; REGISTERED=TSN_INSTANT_CHARTS

Or, is there an alternate to PB 'getURL' for such detailed processing,  perhaps by a PBNI, or external ActiveX?

Thanks,

Ted
ASKER CERTIFIED SOLUTION
Avatar of buasuwan
buasuwan

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of museful
museful

ASKER

Hello,

Your suggestion lead to some testing, which finally solved my problem.  PowerBuilder's getURL method worked fine in the end - I was just storing the cookies in the wrong browser cookie area.  Normally I use Firefox, but PowerBuilder references cookies stored in \Documents and Settings\[User]\Cookies (i.e. where MS Internet Explorer places them).  When I created the required cookie in that Cookie folder, PB getURL found them and used them with no further programming.

However, MS Webbrowser control will be otherwise valuable.

Thanks for the ideas!

Ted Craven