getURL and cookies

Posted on 2006-03-27
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 = ""
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:; 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
    LVL 5

    Accepted Solution

    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


    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

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Programmer's Notepad is, one of the best free text editing tools available, simply because the developers appear to have second-guessed every weird problem or issue a programmer is likely to run into. One of these problems is selecting and deleti…
    Update (December 2011): Since this article was published, the things have changed for good for Android native developers. The Sequoyah Project ( automates most of the tasks discussed in this article. You can even fin…
    The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
    THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.

    737 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

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now