getURL and cookies

Posted on 2006-03-27
Medium Priority
Last Modified: 2013-12-26
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?


Question by:museful

Accepted Solution

buasuwan earned 1500 total points
ID: 16398806
Hi Ted,

    Have you try Microsoft WebBrowser Control?  It works better than getURL() and PostURL().  Please download my sample code from link below.  I think this will solve your problem.



Author Comment

ID: 16417381

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

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In our object-oriented world the class is a minimal unit, a brick for constructing our applications. It is an abstraction and we know well how to use it. In well-designed software we are not usually interested in knowing how objects look in memory. …
Jaspersoft Studio is a plugin for Eclipse that lets you create reports from a datasource.  In this article, we'll go over creating a report from a default template and setting up a datasource that connects to your database.
THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.
Suggested Courses

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question