login about faq

Code Scrap: Dim request As New ChilkatHttpRequest Dim http As New ChilkatHttp Dim response As ChilkatHttpResponse success = http.UnlockComponent("Super_Secret") If Not (success = 1) Then 'Crash and Burn here Exit Sub End If request.AddParam "Size", "1" request.AddParam "page", "2" request.AddParam "Name", "Randy" request.AddParam "Code", "ABC" Set response = http.PostUrlEncoded("http://ragsoftinc.com/dev/index.php", request) //just Safely displays POST and GET vars

strhtml = response.BodyStr

so I get an error HTTP/1.1 400 Bad Request from openresty I'm told due to not sending a UA? html response and LastErrorText also session log

<head><title>400 Bad Request</title></head>

<body bgcolor="white">

400 Bad Request


</body> </html>

******ChilkatLog: PostUrlEncoded: DllDate: Dec 27 2016 ChilkatVersion: UnlockPrefix: RAGSOFHttp Architecture: Little Endian; 32-bit Language: ActiveX VerboseLogging: 0 url: http://ragsoftinc.com/dev/index.php httpRequest: httpVersion: 1.1 verb: GET path: / contentType: charset: windows-1252 sendCharset: 0 mimeHeader: requestParams: requestItem: name: Size value: 1 --requestItem requestItem: name: page value: 2 --requestItem requestItem: name: Name value: Randy --requestItem requestItem: name: Code value: ABC --requestItem --requestParams --httpRequest fullRequest: a_synchronousRequest: generateRequestHeader: httpRequestGenStartLine: genStartLine: startLine: POST /dev/index.php HTTP/1.1 --genStartLine --httpRequestGenStartLine addCookies: Not auto-adding cookies. sendCookies: 1 cookieDir: --addCookies --generateRequestHeader fullHttpRequest: domain: ragsoftinc.com port: 80 ssl: 0 openHttpConnection: Opening connection directly to HTTP server. httpHostname: ragsoftinc.com httpPort: 80 ssl: 0 HTTP connection succeeded. --openHttpConnection connectTime: Elapsed time: 93 millisec sendRequestHeader: sendHeaderElapsedMs: 0 --sendRequestHeader sendRequestBody: sendBodyElapsedMs: 0 --sendRequestBody statusCode: 400 statusText: Bad Request checkCloseConnection: Response includes connection:close header (or proxy-connection:close header) --checkCloseConnection --fullHttpRequest success: 1 --a_synchronousRequest success: 1 --fullRequest Success. --PostUrlEncoded urlObject_loadUrl: --urlObject_loadUrl --ChilkatLog


---- Sending ---- POST /dev/index.php HTTP/1.1 Content-Type: application/x-www-form-urlencoded Host: ragsoftinc.com Content-Length: 33


HTTP/1.1 400 Bad Request Server: openresty/ Date: Wed, 18 Jan 2017 20:27:09 GMT Content-Type: text/html Content-Length: 179 Connection: close

<html> <head><title>400 Bad Request</title></head> <body bgcolor="white">

400 Bad Request

</body> </html>

asked Jan 18 '17 at 15:46

rgibson's gravatar image


Matt, shouldn't an HTTP post request also send a UA string?

(Jan 19 '17 at 19:32) rgibson

Is my question and follow up comment not relevant?

(Jan 20 '17 at 15:14) rgibson

http.SetRequestHeader "User-Agent", "TESTING UA HEADER 1.0/Alpha" Doesn't send UA during a POST using http.SynchronousRequest does not send UA header even though http.UserAgent was set During a POST Anybody have an idea how to send a POST containing a UA string

(Jan 20 '17 at 15:52) rgibson

Wow, I do not know how I missed the request.AddHeader method!

request.AddHeader "User-Agent", "what ever UA string you want" 

I kinda thought there would be a default as there are in other classes.

anyway solved my own issue, thanks


answered Jan 21 '17 at 19:22

rgibson's gravatar image


Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported



Asked: Jan 18 '17 at 15:46

Seen: 3,275 times

Last updated: Jan 21 '17 at 19:22

powered by OSQA