Results 1 to 2 of 2
  1. #1

    VB.Net Api Post Request Failed

    Hello Guys,

    after some hours of Programming im realy got Crazy.
    i Can't figure it out to get it working. Got i stupid?

    Here is my Code:

    Code:
    Dim Request As HttpWebRequest = CType(WebRequest.Create("http://api.mohwstats.com/ps3/player/"), HttpWebRequest)
                ' Request.CookieContainer = ccon
                Request.Headers("userAgent") = "Mozilla/5.0 (Windows NT 6.1; rv:21.0) Gecko/20100101 Firefox/21.0"
                Request.Method = "POST"
                Request.ContentType = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"
                Dim Post As String = "output=lines&opt=scores&player=" & mohwuser
                Dim byteArray() As Byte = Encoding.UTF8.GetBytes(Post)
                Request.ContentLength = byteArray.Length
                Dim DataStream As Stream = Request.GetRequestStream()
                DataStream.Write(byteArray, 0, byteArray.Length)
                DataStream.Close()
                Dim Response As HttpWebResponse = Request.GetResponse()
                DataStream = Response.GetResponseStream()
                Dim reader As New StreamReader(DataStream)
                Dim ServerResponse As String = reader.ReadToEnd()
    
                reader.Close()
                DataStream.Close()
                Response.Close()
    
                RichTextBox1.Clear()
                RichTextBox1.Text = ServerResponse.ToString
    i got the mesage: Der Remoteserver hat einen Fehler zurückgegeben: (417) Expectation Failed.

    please.... can anyone help me?

  2. #2

    Re: VB.Net Api Post Request Failed

    Quote Originally Posted by pfennigbaum View Post
    Hello Guys,

    after some hours of Programming im realy got Crazy.
    i Can't figure it out to get it working. Got i stupid?

    Here is my Code:

    Code:
    Dim Request As HttpWebRequest = CType(WebRequest.Create("http://api.mohwstats.com/ps3/player/"), HttpWebRequest)
                ' Request.CookieContainer = ccon
                Request.Headers("userAgent") = "Mozilla/5.0 (Windows NT 6.1; rv:21.0) Gecko/20100101 Firefox/21.0"
                Request.Method = "POST"
                Request.ContentType = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"
                Dim Post As String = "output=lines&opt=scores&player=" & mohwuser
                Dim byteArray() As Byte = Encoding.UTF8.GetBytes(Post)
                Request.ContentLength = byteArray.Length
                Dim DataStream As Stream = Request.GetRequestStream()
                DataStream.Write(byteArray, 0, byteArray.Length)
                DataStream.Close()
                Dim Response As HttpWebResponse = Request.GetResponse()
                DataStream = Response.GetResponseStream()
                Dim reader As New StreamReader(DataStream)
                Dim ServerResponse As String = reader.ReadToEnd()
    
                reader.Close()
                DataStream.Close()
                Response.Close()
    
                RichTextBox1.Clear()
                RichTextBox1.Text = ServerResponse.ToString
    i got the mesage: Der Remoteserver hat einen Fehler zurückgegeben: (417) Expectation Failed.

    please.... can anyone help me?

    I had the same issue. Try adding this: System.Net.ServicePointManager.Expect100Continue = false; at the top of your code. Got this from here: http://stackoverflow.com/questions/5...ation-failed-c

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
P-STATS NETWORK FORUM LOGIN CREATE ACCOUNT