[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: 400 Bad Request



When you click the link and view it in your browser, you are using GET.  Your code uses POST.  Perhaps you should code a GET request?
--
Sean Porterfield


-----Original Message-----
From: Gerald Magnuson
Sent: Monday, March 11, 2013 10:54
To: HTTPAPI and FTPAPI Projects (ftpapi@xxxxxxxxxxxxxxxxxxxxxx)
Subject: 400 Bad Request

I tried to copy from a working program, but I must have messed up somewhere..

HERE IS THE STRING THAT WORKS, when I try it in a browser:
http://knapportal-test.knapheide.com/modules/getboss/getusersboss.php?input_name=gmagnuson



here is my code:

http_debug(*ON:'/tmp/http_error_RTNBOSS.txt');

Form = WEBFORM_open;

If P1_UsrID <> *blanks ;
  WEBFORM_SetVar(Form: 'input_name': %trim(P1_UsrID) ); EndIF ;

WEBFORM_postData( Form : myPointer
: dataSize );


rc=http_url_post_raw(
'http://knapportal-test.knapheide.com/modules' +
'/getboss/getusersboss.php':
myPointer: dataSize :
1: %paddr('INCOMING')
:HTTP_TIMEOUT
:HTTP_USERAGENT
: 'application/x-www-form-urlencoded' );

if rc <> 1;
         *** rc comes back as 400...

Here is data from the error log:
HTTPAPI Ver 1.23 released 2008-04-24
OS/400 Ver V7R1M0

New iconv() objects set, PostRem=819. PostLoc=0. ProtRem=819. ProtLoc=0
http_persist_open(): entered
http_long_ParseURL(): entered
DNS resolver retrans: 4
DNS resolver retry  : 4
DNS resolver options: x'00000136'
DNS default domain: knapheide.com
DNS server found: 192.168.100.236
DNS server found: 192.168.100.233
http_persist_post(): entered
http_long_ParseURL(): entered
do_post(): entered
POST /modules/getboss/getusersboss.php HTTP/1.1
Host: knapportal-test.knapheide.com
User-Agent:   http-api/1.24
Content-Type:   application/x-www-form-urlencoded
Expect: 100-continue
Content-Length: 20


recvresp(): entered
HTTP/1.1 400 Bad Request
Content-Type: text/html; charset=us-ascii
Server: Microsoft-HTTPAPI/2.0
Date: Mon, 11 Mar 2013 14:37:36 GMT
Connection: close
Content-Length: 311


SetError() #13: HTTP/1.1 400 Bad Request recvdoc parms: identity 311
header_load_cookies() entered
recvdoc(): entered
SetError() #0:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd";>
<HTML><HEAD><TITLE>Bad Request</TITLE>
<META HTTP-EQUIV="Content-Type" Content="text/html; charset=us-ascii"></HEAD> <BODY><h2>Bad Request</h2> <hr><p>HTTP Error 400. The request is badly formed.</p> </BODY></HTML>

SetError() #13: HTTP/1.1 400 Bad Request
http_close(): entered










This email is confidential, intended only for the named recipient(s) above and may contain information that is privileged.  If you have received this message in error or are not the named recipient(s), please notify the sender immediately and delete this email message from your computer as any and all unauthorized distribution or use of this message is strictly prohibited.  Thank you.
-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------