Skip to Content
avatar image
Former Member

GetUrl return codes

Is there any way to get more detail, when you get a -1 (general error) when calling geturl

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • avatar image
    Former Member
    Oct 18, 2016 at 04:22 PM

    I have an example that uses the Win API functions that the GetURL function does, it might work better.

    http://www.topwizprogramming.com/freecode_winhttp.html

    Add comment
    10|10000 characters needed characters exceeded

  • Oct 19, 2016 at 05:56 AM

    A reason for -1 return code may be a timeout. But I don't know a way to get more details when using this function.

    Instead of using powerbuilder functions or Win APIs you may also use Microsoft ActiveX Objects:

    https://msdn.microsoft.com/en-us/library/ms535874%28v=vs.85%29.aspx

    a simple example:

    oleobject lole_XmlHttp
    string ls_url = "http://..."
    TRY
       lole_XmlHttp = create oleobject
       lole_XmlHttp.ConnectToNewObject ("Msxml2.XMLHTTP")
       lole_XmlHttp.Open ("GET", ls_url, FALSE)
       lole_XmlHttp.Send ()
       // check for status (lole_XmlHttp.status) and result (lole_XmlHttp.ResponseBody)
    CATCH (OLERuntimeError errole)
       // useful: errole.GetMessage() and errole.Description
    CATCH (Throwable e)
       // useful: e.GetMessage()
    FINALLY
       lole_XmlHttp.DisconnectObject ()
       DESTROY lole_XmlHttp
    END TRY

    Add comment
    10|10000 characters needed characters exceeded