Post form data in (to) CF
I am working on a project where I need to construct the actual HTTP request. I have run into a roadblock with CFM form pages though. Does anyone know how CF handles form data in a post? CF seems to be expecting/seeing things different then a CGI script. here are a couple of examples as to what I am doing as well as there unexplainable results. 1.1) my test PERL script (just displays the post data) [/opt/cgi-bin]% cat 2.pl #!/usr/local/bin/perl use CGI; $query=new CGI; print $query-header; print $query-param('date_id'); 1.2) The request to that script [~]$ telnet xyz 80 Trying xxx.xxx.xxx.xxx... Connected to xyz.xyz.com. Escape character is '^]'. POST http://xyz.xyz.com/cgi-bin/2.pl HTTP/1.0 Content-Length: 18 date_id=2000-09-21 HTTP/1.1 200 OK Date: Tue, 26 Sep 2000 14:08:58 GMT Server: xx Last-Modified: Tue, 26 Sep 2000 13:45:57 GMT Cache-Control: no-cache Connection: close Content-Type: text/html 2000-09-21Connection closed by foreign host. 2.1) the CFM page cfoutput #form.date_id#/cfoutput 2.2) The request to the CF page [~]$ telnet xyz 80 Trying xxx.xxx.xxx.xxx... Connected to xyz.xyz.com. Escape character is '^]'. POST http://xyz.xyz.com/1.cfm HTTP/1.0 Content-Length: 18 date_id=2000-09-21 HTTP/1.1 200 OK Date: Tue, 26 Sep 2000 14:21:53 GMT Server: Page-Completion-Status: Normal Page-Completion-Status: Abnormal Connection: close Content-Type: text/html /TD/TD/TD/TH/TH/TH/TR/TR/TR/TABLE/TABLE/TABLE/A/A BBREV/ACRONYM/ADDRESS/APPLET/AU/B/BANNER/BIG/BLINK/BLOCKQU OTE/BQ/CAPTION/CENTER /CITE/CODE/COMMENT/DEL/DFN/DIR/DIV/DL/EM/FIG/FN/FONT /FORM/FRAME/FRAMESET/H1/H2/H3/H4/H5/H6/HEAD/I/INS/K BD/LISTING/MAP/MARQUEE /MENU/MULTICOL/NOBR/NOFRAMES/NOSCRIPT/NOTE/OL/P/PARAM/P ERSON/PLAINTEXT/PRE/Q/S/SAMP/SCRIPT/SELECT/SMALL/STRIKE/ STRONG/SUB/SUP/TABLE/ TD/TEXTAREA/TH/TITLE/TR/TT/U/UL/VAR/WBR/XMPHTMLHEAD TITLEError Occurred While Processing Request/TITLE/HEADBODYHRH3Error Occurred While Processi ng Request/H3P TABLE BORDERTRTDH4Error Diagnostic Information/H4PPAn error occurred while evaluating the expression: PPRE#form.date_id#/PRE/P/PError near line 1, column 13.HRPError resolving parameter BFORM.DATE_ID/BPPThe specified form field cannot be found. This problem is very likely due to the fact that you have misspelled the form field name.PP pThe error occurred while processing an element with a general identifier of (#form.date_id#), occupying document position (1:12) to (1:25)./pPPDate/Time: Tue Sep 26 09:22:01 2000BRBrowser: BRRemote Address: 172.24.2.15P/TD/TR/TABLEPPlease inform the a href="mailto:[EMAIL PROTECTED]"site administrator/a that this error has occurred (be sure to include the contents of this page in your message to the administrator).PHR/BODY/HTMLConnection closed by foreign host. [~]$ any insight that you could offer would be appreciated...thanks... benji --- Benji Spencer Web Programmer Moody Bible Institute 312-329-2288 -- Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body.
RE: Post form data in (to) CF
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 One thing that immediately jumps out at me is your POST line. HTTP spec doesn't include the entire URL in the POST, only the path info. So this: POST http://xyz.xyz.com/1.cfm HTTP/1.0 should actually be: POST /1.cfm HTTP/1.0 Host: xyz.xyz.com You can include the hostname in a host header if need be (depending on how your server is setup, that might be required). The POST should only include the path, tho. Other possible gotchas: There's no Content-Type header in your request. Try adding: Content-type: application/x-www-form-urlencoded Your POST data isn't URL encoded. For the body of your HTTP request, try: date_id=2000%2D09%2D21 I think among those three things, you should be able to get a successful POST. CF is a far more picky beast than Perl is, unfortunately... Best regards, and good luck! Zac Bedell -Original Message- From: Benji Spencer [mailto:[EMAIL PROTECTED]] Sent: Tuesday, September 26, 2000 10:27 AM To: CF-Talk Subject: Post form data in (to) CF I am working on a project where I need to construct the actual HTTP request. I have run into a roadblock with CFM form pages though. Does anyone know how CF handles form data in a post? CF seems to be expecting/seeing things different then a CGI script. here are a couple of examples as to what I am doing as well as there unexplainable results. 1.1) my test PERL script (just displays the post data) [/opt/cgi-bin]% cat 2.pl #!/usr/local/bin/perl use CGI; $query=new CGI; print $query-header; print $query-param('date_id'); 1.2) The request to that script [~]$ telnet xyz 80 Trying xxx.xxx.xxx.xxx... Connected to xyz.xyz.com. Escape character is '^]'. POST http://xyz.xyz.com/cgi-bin/2.pl HTTP/1.0 Content-Length: 18 date_id=2000-09-21 HTTP/1.1 200 OK Date: Tue, 26 Sep 2000 14:08:58 GMT Server: xx Last-Modified: Tue, 26 Sep 2000 13:45:57 GMT Cache-Control: no-cache Connection: close Content-Type: text/html 2000-09-21Connection closed by foreign host. 2.1) the CFM page cfoutput #form.date_id#/cfoutput 2.2) The request to the CF page [~]$ telnet xyz 80 Trying xxx.xxx.xxx.xxx... Connected to xyz.xyz.com. Escape character is '^]'. POST http://xyz.xyz.com/1.cfm HTTP/1.0 Content-Length: 18 date_id=2000-09-21 HTTP/1.1 200 OK Date: Tue, 26 Sep 2000 14:21:53 GMT Server: Page-Completion-Status: Normal Page-Completion-Status: Abnormal Connection: close Content-Type: text/html -BEGIN PGP SIGNATURE- Version: PGPfreeware 6.5.8 for non-commercial use http://www.pgp.com iQA/AwUBOdC1QQraVoMWBwRBEQJyUQCffLlooluOzEFL801WYHDdSMcTqfoAn36E fRXJTakEeCjMqP8NJx/pj+OQ =gPFG -END PGP SIGNATURE- -- Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body.
RE: Post form data in (to) CF
One thing that immediately jumps out at me is your POST line. HTTP spec doesn't include the entire URL in the POST, only the path info. So this: POST http://xyz.xyz.com/1.cfm HTTP/1.0 should actually be: POST /1.cfm HTTP/1.0 Host: xyz.xyz.com do you know of a resource for something like this? I would like to verify my GET requests also There's no Content-Type header in your request. Try adding: Content-type: application/x-www-form-urlencoded bingo. I added that (even with all my other oops), and it worked. thanks :) Your POST data isn't URL encoded. For the body of your HTTP request, try: date_id=2000%2D09%2D21 I will actually be receiving the data encoded already. Thanks for pointing this out though.. I think among those three things, you should be able to get a successful POST. CF is a far more picky beast than Perl is, unfortunately... I am much more use to PERL (and PHP now) when CF. At least I know what is going on in them :) thanks... benji --- Ben Spencer Web Support [EMAIL PROTECTED] x 2288 -- Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body.
Re: Post form data in (to) CF
Are you URL Encoding the posted data? I don't think so if your content length is 18 (it should be 22). Your posted data should look something like: date_id=2000%2D09%2D21 HTH, Howie Hamlin - inFusion Project Manager On-Line Data Solutions, Inc. www.CoolFusion.com 631-737-4668 x101 inFusion Mail Server (iMS) - the World's most configurable mail server - Original Message - From: "Benji Spencer" [EMAIL PROTECTED] To: "CF-Talk" [EMAIL PROTECTED] Sent: Tuesday, September 26, 2000 10:26 AM Subject: Post form data in (to) CF I am working on a project where I need to construct the actual HTTP request. I have run into a roadblock with CFM form pages though. Does anyone know how CF handles form data in a post? CF seems to be expecting/seeing things different then a CGI script. here are a couple of examples as to what I am doing as well as there unexplainable results. 1.1) my test PERL script (just displays the post data) [/opt/cgi-bin]% cat 2.pl #!/usr/local/bin/perl use CGI; $query=new CGI; print $query-header; print $query-param('date_id'); 1.2) The request to that script [~]$ telnet xyz 80 Trying xxx.xxx.xxx.xxx... Connected to xyz.xyz.com. Escape character is '^]'. POST http://xyz.xyz.com/cgi-bin/2.pl HTTP/1.0 Content-Length: 18 date_id=2000-09-21 HTTP/1.1 200 OK Date: Tue, 26 Sep 2000 14:08:58 GMT Server: xx Last-Modified: Tue, 26 Sep 2000 13:45:57 GMT Cache-Control: no-cache Connection: close Content-Type: text/html 2000-09-21Connection closed by foreign host. 2.1) the CFM page cfoutput #form.date_id#/cfoutput 2.2) The request to the CF page [~]$ telnet xyz 80 Trying xxx.xxx.xxx.xxx... Connected to xyz.xyz.com. Escape character is '^]'. POST http://xyz.xyz.com/1.cfm HTTP/1.0 Content-Length: 18 date_id=2000-09-21 HTTP/1.1 200 OK Date: Tue, 26 Sep 2000 14:21:53 GMT Server: Page-Completion-Status: Normal Page-Completion-Status: Abnormal Connection: close Content-Type: text/html /TD/TD/TD/TH/TH/TH/TR/TR/TR/TABLE/TABLE/TABLE/A/A BBREV/ACRONYM/ADDRESS/APPLET/AU/B/BANNER/BIG/BLINK/BLOCKQU OTE/BQ/CAPTION/CENTER /CITE/CODE/COMMENT/DEL/DFN/DIR/DIV/DL/EM/FIG/FN/FONT /FORM/FRAME/FRAMESET/H1/H2/H3/H4/H5/H6/HEAD/I/INS/K BD/LISTING/MAP/MARQUEE /MENU/MULTICOL/NOBR/NOFRAMES/NOSCRIPT/NOTE/OL/P/PARAM/P ERSON/PLAINTEXT/PRE/Q/S/SAMP/SCRIPT/SELECT/SMALL/STRIKE/ STRONG/SUB/SUP/TABLE/ TD/TEXTAREA/TH/TITLE/TR/TT/U/UL/VAR/WBR/XMPHTMLHEAD TITLEError Occurred While Processing Request/TITLE/HEADBODYHRH3Error Occurred While Processi ng Request/H3P TABLE BORDERTRTDH4Error Diagnostic Information/H4PPAn error occurred while evaluating the expression: PPRE#form.date_id#/PRE/P/PError near line 1, column 13.HRPError resolving parameter BFORM.DATE_ID/BPPThe specified form field cannot be found. This problem is very likely due to the fact that you have misspelled the form field name.PP pThe error occurred while processing an element with a general identifier of (#form.date_id#), occupying document position (1:12) to (1:25)./pPPDate/Time: Tue Sep 26 09:22:01 2000BRBrowser: BRRemote Address: 172.24.2.15P/TD/TR/TABLEPPlease inform the a href="mailto:[EMAIL PROTECTED]"site administrator/a that this error has occurred (be sure to include the contents of this page in your message to the administrator).PHR/BODY/HTMLConnection closed by foreign host. [~]$ any insight that you could offer would be appreciated...thanks... benji --- Benji Spencer Web Programmer Moody Bible Institute 312-329-2288 -- Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body. -- Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body.
Re: Post form data in (to) CF
Have you tried removing the scope? Are you posting to cf using perl or the other way around? ~Justin MacCarthy - Original Message - From: "Benji Spencer" [EMAIL PROTECTED] To: "CF-Talk" [EMAIL PROTECTED] Sent: Tuesday, September 26, 2000 3:26 PM Subject: Post form data in (to) CF I am working on a project where I need to construct the actual HTTP request. I have run into a roadblock with CFM form pages though. Does anyone know how CF handles form data in a post? CF seems to be expecting/seeing things different then a CGI script. here are a couple of examples as to what I am doing as well as there unexplainable results. 1.1) my test PERL script (just displays the post data) [/opt/cgi-bin]% cat 2.pl #!/usr/local/bin/perl use CGI; $query=new CGI; print $query-header; print $query-param('date_id'); 1.2) The request to that script [~]$ telnet xyz 80 Trying xxx.xxx.xxx.xxx... Connected to xyz.xyz.com. Escape character is '^]'. POST http://xyz.xyz.com/cgi-bin/2.pl HTTP/1.0 Content-Length: 18 date_id=2000-09-21 HTTP/1.1 200 OK Date: Tue, 26 Sep 2000 14:08:58 GMT Server: xx Last-Modified: Tue, 26 Sep 2000 13:45:57 GMT Cache-Control: no-cache Connection: close Content-Type: text/html 2000-09-21Connection closed by foreign host. 2.1) the CFM page cfoutput #form.date_id#/cfoutput 2.2) The request to the CF page [~]$ telnet xyz 80 Trying xxx.xxx.xxx.xxx... Connected to xyz.xyz.com. Escape character is '^]'. POST http://xyz.xyz.com/1.cfm HTTP/1.0 Content-Length: 18 date_id=2000-09-21 HTTP/1.1 200 OK Date: Tue, 26 Sep 2000 14:21:53 GMT Server: Page-Completion-Status: Normal Page-Completion-Status: Abnormal Connection: close Content-Type: text/html /TD/TD/TD/TH/TH/TH/TR/TR/TR/TABLE/TABLE/TABLE/A/A BBREV/ACRONYM/ADDRESS/APPLET/AU/B/BANNER/BIG/BLINK/BLOCKQU OTE/BQ/CAPTION/CENTER /CITE/CODE/COMMENT/DEL/DFN/DIR/DIV/DL/EM/FIG/FN/FONT /FORM/FRAME/FRAMESET/H1/H2/H3/H4/H5/H6/HEAD/I/INS/K BD/LISTING/MAP/MARQUEE /MENU/MULTICOL/NOBR/NOFRAMES/NOSCRIPT/NOTE/OL/P/PARAM/P ERSON/PLAINTEXT/PRE/Q/S/SAMP/SCRIPT/SELECT/SMALL/STRIKE/ STRONG/SUB/SUP/TABLE/ TD/TEXTAREA/TH/TITLE/TR/TT/U/UL/VAR/WBR/XMPHTMLHEAD TITLEError Occurred While Processing Request/TITLE/HEADBODYHRH3Error Occurred While Processi ng Request/H3P TABLE BORDERTRTDH4Error Diagnostic Information/H4PPAn error occurred while evaluating the expression: PPRE#form.date_id#/PRE/P/PError near line 1, column 13.HRPError resolving parameter BFORM.DATE_ID/BPPThe specified form field cannot be found. This problem is very likely due to the fact that you have misspelled the form field name.PP pThe error occurred while processing an element with a general identifier of (#form.date_id#), occupying document position (1:12) to (1:25)./pPPDate/Time: Tue Sep 26 09:22:01 2000BRBrowser: BRRemote Address: 172.24.2.15P/TD/TR/TABLEPPlease inform the a href="mailto:[EMAIL PROTECTED]"site administrator/a that this error has occurred (be sure to include the contents of this page in your message to the administrator).PHR/BODY/HTMLConnection closed by foreign host. [~]$ any insight that you could offer would be appreciated...thanks... benji --- Benji Spencer Web Programmer Moody Bible Institute 312-329-2288 -- Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body. -- Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body.
Re: Post form data in (to) CF
Howie has a free windows based tool @ http://www.coolfusion.com/http.htm V. handy .. Justin MacCarthy do you know of a resource for something like this? I would like to verify my GET requests also There's no Content-Type header in your -- Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body.
Re: Post form data in (to) CF
Have you tried removing the scope? Are you posting to cf using perl or the other way around? actually neither. the perl test I did was just to show that what I was doing worked..however I wasn't doing eveything I needed. I am making a direct HTTP request to the web server. benji --- Benji Spencer Web Programmer Moody Bible Institute 312-329-2288 -- Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body.
RE: Post form data in (to) CF
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 One thing that immediately jumps out at me is your POST line. HTTP spec doesn't include the entire URL in the POST, only the path info. So this: POST http://xyz.xyz.com/1.cfm HTTP/1.0 should actually be: POST /1.cfm HTTP/1.0 Host: xyz.xyz.com do you know of a resource for something like this? I would like to verify my GET requests also Try RFC 2616. That's the HTTP/1.1 spec, so you can't get much more definitive than that. It's a bit of a tome (200ish pages), but if you're writing even a simple HTTP agent, it's really required reading. It also points out more information on assorted other resources like MIME URL encoding. That RFC can be found at http://www.ietf.org/rfc/rfc2616.txt. There's no Content-Type header in your request. Try adding: Content-type: application/x-www-form-urlencoded bingo. I added that (even with all my other oops), and it worked. thanks :) You're quite welcome! Your POST data isn't URL encoded. For the body of your HTTP request, try: date_id=2000%2D09%2D21 I will actually be receiving the data encoded already. Thanks for pointing this out though.. OK. That's definitely one thing that will give CF indigestion... (*burp!*) I think among those three things, you should be able to get a successful POST. CF is a far more picky beast than Perl is, unfortunately... I am much more use to PERL (and PHP now) when CF. At least I know what is going on in them :) *nods* In general, CF is just picky. As long as you follow the RFC, you should be okay. BE AWARE, however that CF disregards the RFC itself in a few spots. Namely it doesn't use CR/LF to delimit all of its headers as it should. Tags like CFContent, CFHeader, or anything else that manipulate the returned headers sometimes use an LF only; even tho the RFC specifies that CF/LF is REQUIRED. That's something to be aware of if you'll be parsing returns from CF. Best regards, Zac Bedell -BEGIN PGP SIGNATURE- Version: PGPfreeware 6.5.8 for non-commercial use http://www.pgp.com iQA/AwUBOdDC1wraVoMWBwRBEQK0lACg9shhG9aSMw+NJY8bOUZn3fHFc14An3rf sOg86DMHQ1qA8RM5E5QGCtFg =xDxF -END PGP SIGNATURE- -- Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body.