Hi everyone, have a unique issue I believe someone on here could help me on.
I am using the HTTP POST API of a service, which is intended for programmers to utilize. However, the way their server receives the HTTP POST is non-traditional, I can show an example.
POST http://poster.example.com/ HTTP/1.1
Host: poster.example.com
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:22.0) Gecko/20100101 Firefox/22.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Type: multipart/form-data; boundary=---------------------------1306345729939
Content-Length: 356
-----------------------------1306345729939
Content-Disposition: form-data; name="function"
balance
-----------------------------1306345729939
Content-Disposition: form-data; name="username"
client
-----------------------------1306345729939
Content-Disposition: form-data; name="password"
qwerty
-----------------------------1306345729939--
The POST request to their server must be in this form.
However, the HttpWebRequest and WebClient Headers property do not let me use line feeds when adding a header, so I cannot replicate this header using the Headers.Add method. (It throws a runtime error when trying to add a header containing vbCrLf.)
I tried using a TCPClient class because I know I can create any header I want as a string even if it includes line feeds, is this possible with HttpWebRequest or WebClient?
I am not an expert with TCPClient and am having problems reading the response from the server, so I'd rather find a solution using HttpWebRequest or WebClient.
Thank you very much too whomever answers. +rep if it solves the problem. :wave:
P.S. I have emailed the service provider asking them for help but I am guessing they will be super slow to answer.
I am using the HTTP POST API of a service, which is intended for programmers to utilize. However, the way their server receives the HTTP POST is non-traditional, I can show an example.
POST http://poster.example.com/ HTTP/1.1
Host: poster.example.com
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:22.0) Gecko/20100101 Firefox/22.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Type: multipart/form-data; boundary=---------------------------1306345729939
Content-Length: 356
-----------------------------1306345729939
Content-Disposition: form-data; name="function"
balance
-----------------------------1306345729939
Content-Disposition: form-data; name="username"
client
-----------------------------1306345729939
Content-Disposition: form-data; name="password"
qwerty
-----------------------------1306345729939--
The POST request to their server must be in this form.
However, the HttpWebRequest and WebClient Headers property do not let me use line feeds when adding a header, so I cannot replicate this header using the Headers.Add method. (It throws a runtime error when trying to add a header containing vbCrLf.)
I tried using a TCPClient class because I know I can create any header I want as a string even if it includes line feeds, is this possible with HttpWebRequest or WebClient?
I am not an expert with TCPClient and am having problems reading the response from the server, so I'd rather find a solution using HttpWebRequest or WebClient.
Thank you very much too whomever answers. +rep if it solves the problem. :wave:
P.S. I have emailed the service provider asking them for help but I am guessing they will be super slow to answer.