I am having problems with my program that is unable to fill-up and submit a website form. It only browses the website and stops there. I used Live Http Headers to retrieve the needed data for my program to auto fill-up the website.
Here is my code:

        Dim postData As String = "authenticity_token=WBawETqvZ43D%2FKHsWgFKe77044tr6ZzTjrQ%2FfVWEUmc%3D&email%5Bto_address%5D=test1%40email.com&email%5Bfrom_name%5D=Test+Name&email%5Bfrom_address%5D=test2%40email.com&email%5Bnote%5D=test&email%5Bcopy_yourself%5D=0&id=house-of-pies-466226000"
        Dim tempCookies As New CookieContainer
        Dim encoding As New UTF8Encoding
        Dim byteData As Byte() = encoding.GetBytes(postData)

        Dim postReq As HttpWebRequest = DirectCast(WebRequest.Create("http://www.yellowpages.com/los-angeles-ca/mip/house-of-pies-466226000/send_email?lid=1000083727260"), HttpWebRequest)
        postReq.Method = "POST"
        postReq.KeepAlive = True
        postReq.CookieContainer = tempCookies
        postReq.ContentType = "application/x-form-urlencoded"
        postReq.Referer = "http://www.yellowpages.com/los-angeles-ca/mip/house-of-pies-466226000/send_email?lid=1000083727260"
        postReq.UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:22.0) Gecko/20100101 Firefox/22.0"
        postReq.ContentLength = byteData.Length

        Dim postreqstream As Stream = postReq.GetRequestStream()
        postreqstream.Write(byteData, 0, byteData.Length)
        postreqstream.Close()

the website form i want to fill up and submit using my program:

http://www.yellowpages.com/los-angeles-ca/mip/house-of-pies-466226000/email_form?lid=1000083727260

the HTTP header i was basing on:

http://i.imgur.com/iJ7JX3W.jpg

I think there is something wrong with my encoding part which prevents it from encoding the specified datas i declared to the website form. I really need help with this. Thanks in advance

Edited 3 Years Ago by intes2010

i have solved my problem. i just revised my code and made it shorter.

Deset Tour From Marrakech
we'll help you to put together the cultural itinerary or trekking excursions of a lifetime ! Our sample Morocco We organizes excursions, trips and tours from Marrakech to several destinations in Morocco.
visit http://www.nomadexperience.com

This question has already been answered. Start a new discussion instead.