0

私は、HTTPWEBREQUESTに必然的に依存するプログラムのPOSTメソッドの代わりにGETメソッドを使用しようとしていました..ここに私が使用したコードがあります

    Dim postData As String = "GET /fbml/ajax/dialog/apprequests?message=Here%27s%20a%20Anvil%20for%20your%20pet%20in%20Wild%20Ones!%20Could%20you%20help%20me%20by%20sending%20a%20gift%20back%3F&data=[%7B%22request_type%22%3A%22gift_v2%22%2C%20%22gift%22%3A%22anvil%22%7D%2C%7B%22track%22%3A%22invite-Gift-request2-anvil-20120112-0%22%7D]&to=[%22100003034461289%22]&e2e=%7B%7D&app_id=101628414658&locale=en_US&sdk=joey&display=async&frictionless=true&redirect_uri=https%3A%2F%2Fwild-fb-apache-active-vip.playdom.com%2Fpub%2Fphp%2F&__d=1&__user=1668282525&__a=1&__dyn=7n8ahyj3419Aw&__req=3 HTTP/1.1"
    Dim tempCookies As New CookieContainer
    Dim encoding As New UTF8Encoding
    Dim byteData As Byte() = encoding.GetBytes(postData)

    Dim postReq As HttpWebRequest = DirectCast(WebRequest.Create("https://apps.facebook.com/fbml/ajax/dialog/apprequests?message=Here%27s%20a%20Anvil%20for%20your%20pet%20in%20Wild%20Ones!%20Could%20you%20help%20me%20by%20sending%20a%20gift%20back%3F&data=[%7B%22request_type%22%3A%22gift_v2%22%2C%20%22gift%22%3A%22anvil%22%7D%2C%7B%22track%22%3A%22invite-Gift-request2-anvil-20120112-0%22%7D]&to=[%22100003034461289%22]&e2e=%7B%7D&app_id=101628414658&locale=en_US&sdk=joey&display=async&frictionless=true&redirect_uri=https%3A%2F%2Fwild-fb-apache-active-vip.playdom.com%2Fpub%2Fphp%2F&__d=1&__user=1668282525&__a=1&__dyn=7n8ahyj3419Aw&__req=3"), HttpWebRequest)
    postReq.Method = "GET"
    postReq.KeepAlive = True
    postReq.CookieContainer = tempCookies
    postReq.ContentType = "application/x-javascript; charset=utf-8"
    postReq.Referer = "https://apps.facebook.com/fbml/ajax/dialog/apprequests?message=Here%27s%20a%20Anvil%20for%20your%20pet%20in%20Wild%20Ones!%20Could%20you%20help%20me%20by%20sending%20a%20gift%20back%3F&data=[%7B%22request_type%22%3A%22gift_v2%22%2C%20%22gift%22%3A%22anvil%22%7D%2C%7B%22track%22%3A%22invite-Gift-request2-anvil-20120112-0%22%7D]&to=[%22100003034461289%22]&e2e=%7B%7D&app_id=101628414658&locale=en_US&sdk=joey&display=async&frictionless=true&redirect_uri=https%3A%2F%2Fwild-fb-apache-active-vip.playdom.com%2Fpub%2Fphp%2F&__d=1&__user=1668282525&__a=1&__dyn=7n8ahyj3419Aw&__req=3"
    postReq.UserAgent = "Mozilla/5.0 (Windows; U; Windows NT 6.1; ru; rv:1.9.2.3) Gecko/20100401 Firefox/4.0 (.NET CLR 3.5.30729)"
    postReq.ContentLength = byteData.Length
    Dim postreqstream As Stream = postReq.GetRequestStream()
    postreqstream.Write(byteData, 0, byteData.Length)
    postreqstream.Close()
    Dim postresponse As HttpWebResponse

    postresponse = DirectCast(postReq.GetResponse(), HttpWebResponse)
    tempCookies.Add(postresponse.Cookies)
    logincookie = tempCookies
    Dim postreqreader As New StreamReader(postresponse.GetResponseStream())

    Dim thepage As String = postreqreader.ReadToEnd
    WebBrowser1.DocumentText = thepage
4

1 に答える 1