dcsimg
Results 1 to 6 of 6

Thread: [VB6] HttpHelps class (WinInet + Get/Post + proxy)

  1. #1

    Thread Starter
    Member Dragokas's Avatar
    Join Date
    Aug 2015
    Location
    Ukraine
    Posts
    533

    [VB6] HttpHelps class (WinInet + Get/Post + proxy)

    Author: xxdoc123

    Fork by Dragokas

    Purpose:
    GET/POST requests to Http(s), ftp protocols with features like:
    - Proxy (http and Socks4 proxy type only)
    - Coockie
    - Referer
    - UserAgent
    - Follow redirection

    Methods:
    ReturnBytArry (Get)
    ReturnString (Get)

    NocookieAndcache (Let)
    SaveCookietoIE (Let)

    TimeOut (Let)

    AutomatiRedirection (Let) - to follow http(s) redirection

    UseAuthorization (Let) - bool, to use next 2 methods
    UseName (Let)
    UsePassword (Let)

    UseProxy (Let/Get)
    ProxyAddress (Let)

    UseProxyIE (Let/Get) - use IE settings for proxy Host/Port
    UseProxySocks4 (Let/Get)

    UseProxyAuthorization (Let/Get) - bool, to use next 2 methods
    ProxyUser (Let)
    ProxyPass (Let)

    UserAgent (Let/Get)
    Referer (Let)
    PostDatas (Let)
    URL (Let/Get)
    RequestMethod (Let/Get)
    RequestCookies (Let/Get)
    RequestHeaders (Let/Get)
    ReturnStatus (Get)
    ReturnCode (Get)
    Functions

    only one:
    Code:
    API_Http (
                             Optional sURL As String, _
                             Optional sMethod As Method, _
                             Optional sRequestHeads As String = "", _
                             Optional sCookie As String = "", _
                             Optional sPostData As String = "")
    )
    Using:
    - Add clsHttpHelps.cls to your project
    - Use 1 of 2 variants:
    1. Call simple one-line solution, like:
    Code:
    bIsSuccess = cInet.API_Http ("hxxp://some.url/", cGET)
    2. Or fill all needed bundle of properties and call cInet.API_Http() without arguments.

    Second variant is in GUI demo below.

    Name:  pic.jpg
Views: 250
Size:  26.5 KB

    P.S. To check proxy on localhost you can install 'HandyCache' program.

    Known issues:
    SOCKS5 is not supported (?), it looks like even IE and Edge in Win10 can't connect using Socks5. lol. Can you confirm?
    Timeout is work only for limited cases. Multithreading will be a good idea.

    ----
    List of changes:

    v.1.3
    - Added Socks4 proxy support
    - Added some new TimeOut options (private)

    v.1.2
    - Proxy is now apllied to all protocols (by default it was http only)
    - Fixed "Out of range" error when no data is read to m_BytReturnBytArry()
    - Improved retrieving of status message
    - Added error 400 as a mark for .API_Http to return 'false'
    - Added property .UseProxyIE to use system (Internet Explorer) setting of host/port proxy.

    v.1.1
    - Converted functions into Unicode, fixed types. WARNING: it doesn't mean these functions can fully support Unicode (that is WinInet restriction) !!!
    - Added ReturnCode / ReturnString properties.
    - API_Http returns 'false' on 404 error now
    - Fixed 3 potential infinite loops (cert / proxy / auth. requests resending)
    - Changed default 'UserAgent' into 'Firefox'
    - Added error handlers, modified return status text logic
    - 'm_bAutomatiRedirection' bool meaning is set vice versa: true - to follow redirects
    - Made all arguments of 'API_Http' function as optional. They can be set by class properties
    - Removed unused (garbage) properties
    - Renamed some properties
    Attached Files Attached Files

  2. #2
    Hyperactive Member
    Join Date
    Aug 2016
    Posts
    263

    Re: [VB6] HttpHelps class (WinInet + Get/Post + proxy)

    Quote Originally Posted by Dragokas View Post
    Author: xxdoc123

    Fork by Dragokas

    Purpose:
    GET/POST requests to Http(s), ftp protocols with features like:
    - Proxy (http and Socks4 proxy type only)
    - Coockie
    - Referer
    - UserAgent
    - Follow redirection

    Methods:


    Functions

    only one:
    Code:
    API_Http (
                             Optional sURL As String, _
                             Optional sMethod As Method, _
                             Optional sRequestHeads As String = "", _
                             Optional sCookie As String = "", _
                             Optional sPostData As String = "")
    )
    Using:
    - Add clsHttpHelps.cls to your project
    - Use 1 of 2 variants:
    1. Call simple one-line solution, like:
    Code:
    bIsSuccess = cInet.API_Http ("hxxp://some.url/", cGET)
    2. Or fill all needed bundle of properties and call cInet.API_Http() without arguments.

    Second variant is in GUI demo below.

    Name:  pic.jpg
Views: 250
Size:  26.5 KB

    P.S. To check proxy on localhost you can install 'HandyCache' program.

    Known issues:
    SOCKS5 is not supported (?), it looks like even IE and Edge in Win10 can't connect using Socks5. lol. Can you confirm?
    Timeout is work only for limited cases. Multithreading will be a good idea.

    ----
    List of changes:

    v.1.3
    - Added Socks4 proxy support
    - Added some new TimeOut options (private)

    v.1.2
    - Proxy is now apllied to all protocols (by default it was http only)
    - Fixed "Out of range" error when no data is read to m_BytReturnBytArry()
    - Improved retrieving of status message
    - Added error 400 as a mark for .API_Http to return 'false'
    - Added property .UseProxyIE to use system (Internet Explorer) setting of host/port proxy.

    v.1.1
    - Converted functions into Unicode, fixed types. WARNING: it doesn't mean these functions can fully support Unicode (that is WinInet restriction) !!!
    - Added ReturnCode / ReturnString properties.
    - API_Http returns 'false' on 404 error now
    - Fixed 3 potential infinite loops (cert / proxy / auth. requests resending)
    - Changed default 'UserAgent' into 'Firefox'
    - Added error handlers, modified return status text logic
    - 'm_bAutomatiRedirection' bool meaning is set vice versa: true - to follow redirects
    - Made all arguments of 'API_Http' function as optional. They can be set by class properties
    - Removed unused (garbage) properties
    - Renamed some properties
    I have rarely used winnet. I think it is better to use winsock

  3. #3
    Hyperactive Member
    Join Date
    Aug 2016
    Posts
    263

    Re: [VB6] HttpHelps class (WinInet + Get/Post + proxy)

    Quote Originally Posted by Dragokas View Post
    Author: xxdoc123

    Fork by Dragokas

    Purpose:
    GET/POST requests to Http(s), ftp protocols with features like:
    - Proxy (http and Socks4 proxy type only)
    - Coockie
    - Referer
    - UserAgent
    - Follow redirection

    Methods:


    Functions

    only one:
    Code:
    API_Http (
                             Optional sURL As String, _
                             Optional sMethod As Method, _
                             Optional sRequestHeads As String = "", _
                             Optional sCookie As String = "", _
                             Optional sPostData As String = "")
    )
    Using:
    - Add clsHttpHelps.cls to your project
    - Use 1 of 2 variants:
    1. Call simple one-line solution, like:
    Code:
    bIsSuccess = cInet.API_Http ("hxxp://some.url/", cGET)
    2. Or fill all needed bundle of properties and call cInet.API_Http() without arguments.

    Second variant is in GUI demo below.

    Name:  pic.jpg
Views: 250
Size:  26.5 KB

    P.S. To check proxy on localhost you can install 'HandyCache' program.

    Known issues:
    SOCKS5 is not supported (?), it looks like even IE and Edge in Win10 can't connect using Socks5. lol. Can you confirm?
    Timeout is work only for limited cases. Multithreading will be a good idea.

    ----
    List of changes:

    v.1.3
    - Added Socks4 proxy support
    - Added some new TimeOut options (private)

    v.1.2
    - Proxy is now apllied to all protocols (by default it was http only)
    - Fixed "Out of range" error when no data is read to m_BytReturnBytArry()
    - Improved retrieving of status message
    - Added error 400 as a mark for .API_Http to return 'false'
    - Added property .UseProxyIE to use system (Internet Explorer) setting of host/port proxy.

    v.1.1
    - Converted functions into Unicode, fixed types. WARNING: it doesn't mean these functions can fully support Unicode (that is WinInet restriction) !!!
    - Added ReturnCode / ReturnString properties.
    - API_Http returns 'false' on 404 error now
    - Fixed 3 potential infinite loops (cert / proxy / auth. requests resending)
    - Changed default 'UserAgent' into 'Firefox'
    - Added error handlers, modified return status text logic
    - 'm_bAutomatiRedirection' bool meaning is set vice versa: true - to follow redirects
    - Made all arguments of 'API_Http' function as optional. They can be set by class properties
    - Removed unused (garbage) properties
    - Renamed some properties
    I have rarely used winnet. I think it is better to use winsock。

  4. #4

    Thread Starter
    Member Dragokas's Avatar
    Join Date
    Aug 2015
    Location
    Ukraine
    Posts
    533

    Re: [VB6] HttpHelps class (WinInet + Get/Post + proxy)

    I never used WinInet or WinSock before
    So, your initial code was good for me at least to understant how to set up such connection.

  5. #5
    Hyperactive Member
    Join Date
    Aug 2016
    Posts
    263

    Re: [VB6] HttpHelps class (WinInet + Get/Post + proxy)

    yes 。because used innet control can not get ”HttpOnly“ cookie。so used this can get and set to control。

  6. #6

    Thread Starter
    Member Dragokas's Avatar
    Join Date
    Aug 2015
    Location
    Ukraine
    Posts
    533

    Re: [VB6] HttpHelps class (WinInet + Get/Post + proxy)

    Sorry, cannot understand.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width