Results 1 to 40 of 87

Thread: Winsock: Making HTTP POST/GET Requests

Threaded View

  1. #1

    Thread Starter
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906

    Winsock: Making HTTP POST/GET Requests

    Introduction

    A question often asked is how to use Visual Basic to submit information to server side web scripts. Such as form variables. This small demonstration application shows how to accomplish this with the use of VB6 and the WinSock control.

    In order to add the Winsock Control to your VB6 application, right click on the tool box, select components from the menu and check the box "Microsoft Winsock Control".

    A Bit about HTTP

    The Winsock control enables you to establish a connection to another computer using either TCP / UDP and transfer data over that connection. HTTP (Hypertext Transfer Protocol) is used to request and send data to web resources and it is up to the programmer to construct the HTTP request and parse the response.

    There are two types of HTTP request, a POST request and a GET request. A POST request is used to send data to the server resource and a GET request is used to retrieve data from the server.

    Data can also be passed to the server resource by means of a query string in both GET and POST requests. The query string is appended to the end of a URL in the form:

    [http://www.domain.com/resource.php?variable1=value&variable2=value



    Using the Demo Application

    The demo application allows you to enter a URL and choose between a HTTP GET and HTTP POST request. The variable's section gives you the opportunity to send additional variables along with the HTTP request.

    Variables
    If you choose the GET method these variables will be added to the URL's query string. If you choose a POST request, they will be put into the body of the HTTP request.

    Headers
    The headers section allows you to add some custom HTTP headers, such as a user agent and cookies.

    Sending the Request
    Once the request has been sent you will be able to see the exact HTTP request sent to the server. After a short time you will also see the HTTP response.

    You can test the application using the following URL:

    http://adam.codedv.com/examples/post_dump.php

    Attached Images Attached Images  
    Attached Files Attached Files
    Last edited by visualAd; May 2nd, 2005 at 05:44 AM.
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

Posting Permissions

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



Click Here to Expand Forum to Full Width