Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx_professional thread: POST to multiple URLS


Message #1 by "Robert Sindall" <rsindall@z...> on Mon, 7 Oct 2002 14:17:49 +0100
Re: POST to multiple URLS


Found & taken from:
.NET 247 : ngfx-io - sending http post request
http://www.dotnet247.com/247reference/msgs/19/95431.aspx


    'The function below takes an absolute URL and parameters in the form of
"param1=blah&m2=bloh", makes a POST request, and returns the resulting
HTML page as a string.
    Function readHtmlPage(ByVal url As String, ByVal params As String) As 
String
        Dim result As String = ""
        Dim myWriter As StreamWriter

        Dim objRequest As HttpWebRequest = WebRequest.Create(url)
        objRequest.Method = "POST"
        objRequest.ContentLength = params.Length
        objRequest.ContentType = "application/x-www-form-urlencoded"
        objRequest.KeepAlive = False

        Try
            myWriter = New StreamWriter(objRequest.GetRequestStream())
            myWriter.Write(params)
        Catch e As Exception
            Return e.Message
        Finally
            myWriter.Close()
        End Try

        Dim objResponse As HttpWebResponse = objRequest.GetResponse()
        Dim sr As StreamReader
        sr = New StreamReader(objResponse.GetResponseStream())
        result = sr.ReadToEnd()
        sr.Close()

        myWriter.Close()

        Return result
    End Function


    'The below code I created demostrates how to use the above function to 
send a POST request to an URL/page
    Public Function PostPageRequest() As Boolean
        Dim str1 As String

        Try
            'First you have to identify the form field(s) together with 
their values that will be sent to the resulting URL/page

            'the readHtmlPage function will return a string which is the 
page from the POST request
            str1 = readHtmlPage("https://www.income.com.sg/i-
shop/category.asp", "category=Promotions+%26+Specials")

            'then you may continue to process the resulting page from the 
post request

            Return True
        Catch
            Return False
        End Try
    End Function





> Hi
I've got a list of urls and I need to POST the same set of values to each
URL.
how can I automate the process?
e.g. Search Engine Submissions
list of urls to submit websites to.

Robert Sindall
Senior Developer
_______________________________

zethics
our technology is your business
www.zethics.com
e: rsindall@z...
v: +xx xxxx xxxxxx

  Return to Index