Question:
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">******ChilkatLog: PostUrlEncoded: DllDate: Dec 27 2016 ChilkatVersion: 9.5.0.65 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
SESSION LOG
---- 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/1.11.2.2 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">
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