Re: [PHP] HTTP POST Question
Hmmm, I'm sorry - I didn't see any mention of flash in this thread. That is a completely different story from what has been talked about so far. What do you mean you can't write the unlink code? You mean you want to delete a file somewhere from flash? That shouldn't be a problem - post from flash to a php script - the script can do the unlink (make sure you have correct permissions and *build* the correct path), then return a result code back to flash. Not sure if I'm on target for your question or not. HTH, J -- Julian Wood Multimedia Developer University of Calgary on 2/20/01 9:46 AM, Jan Grafstrm at [EMAIL PROTECTED] wrote: Thankyou Julian but I am posting my variable from flash5. The posting is not my problem. I just can`t write the unlink code. Julian Wood wrote: Check out http://px.sklar.com/code-pretty.html?code_id=313 It is a post class written by Alan van den Bosch which will do what you want (post to a perl script, retrieve the results, and let you manipulate them from within the posting php script). Here's some code using this class. I've simplified this so it is untested in its current state, but should work. I've used this class in many projects and it works very well. ?php include("post.php"); $a=new http_post; #where do you want to post today $a-set_action("http://$SERVER_ADDR/cgi-bin/hello.pl"); # add some post arguments $a-set_element('foo','bar'); #do the post $res = $a-send(); #strip header $res = strstr($res, "\r\n\r\n"); #display the results echo $res; ? HTH, J -- Julian Wood Multimedia Developer University of Calgary on 2/19/01 10:15 AM, John Monfort at [EMAIL PROTECTED] wrote: 1. It appears if I use the header function I have to redirect the page to another page, it doesn't appear possible to retrieve a page into the current page? Unless someone can show me some code that would do that. If all you want is to display the remote page, within the local page, then all you need is fpassthru() ex. $server = "http://www.site.com"; $fp = fopen($server,"r")// "r" is for reading fpassthru($fp); This will display the results of the remote file (html or whatever) into the local file (in this case, your PHP file). -Original Message- From:Milan Mlynarcik [SMTP:[EMAIL PROTECTED]] Sent:Monday, February 19, 2001 7:33 AM To:Montgomery-Recht, Evan Subject:Re: [PHP] HTTP POST Question You have to use header() function and how POST work you can find in HTTP RFC at http://www.w3.org/Protocols/rfc2616/rfc2616.html - Milan Mlynarcik Web Programmer Charmed Technology Slovakia Nam. sv. Egidia 16/37 058 01 Poprad, Slovakia E-mail: [EMAIL PROTECTED] Office: 00421 92 7881 874 Mobile: 00421 905 964 535 Web page: http://www.charmed.com/ - - Original Message - From: "Montgomery-Recht, Evan" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, February 19, 2001 1:06 PM Subject: [PHP] HTTP POST Question Good morning... This should be a good monday morning question. I have a cgi-bin written in perl (it's actually, a interface to a perl-module which is a interface to a telnet-like protocol). Anyways what I need to do is I have already existing code written in PHP, but at some point I need to call this cgi-bin and get a return code from it and process (good/bad result) and return to completed php script that says it called this cgi-bin. It's not very clear how to set the HTTP_POST_VARS for sending to a post command (which doesn't seem to exist); Any ideas I don't see a function called: $HTTP_POST_VARS =set variables; $result = http_post("http://localhost/cgi-bin/script.pl"); Thanks, evan PS. I'd appricate a working example, even if it's a dummy version. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] HTTP POST Question
Good morning... This should be a good monday morning question. I have a cgi-bin written in perl (it's actually, a interface to a perl-module which is a interface to a telnet-like protocol). Anyways what I need to do is I have already existing code written in PHP, but at some point I need to call this cgi-bin and get a return code from it and process (good/bad result) and return to completed php script that says it called this cgi-bin. It's not very clear how to set the HTTP_POST_VARS for sending to a post command (which doesn't seem to exist); Any ideas I don't see a function called: $HTTP_POST_VARS =set variables; $result = http_post("http://localhost/cgi-bin/script.pl"); Thanks, evan PS. I'd appricate a working example, even if it's a dummy version. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] HTTP POST Question
Hi I read a article about posting data .. and there was a script but I dont know resource of this script. But this is working. let me give you a example ?php // Posting function function PostToHost($host, $path, $data_to_send) { $fp = fsockopen($host,80); fputs($fp, "POST $path HTTP/1.1\n"); fputs($fp, "Host: $host\n"); fputs($fp, "Content-type: application/x-www-form-urlencoded\n"); fputs($fp, "Content-length: ".strlen($data_to_send)."\n"); fputs($fp, "Connection: close\n\n"); fputs($fp, $data_to_send); while(!feof($fp)) { echo fgets($fp, 128); } fclose($fp); } $host = "cgiserver.x.com"; // target server $path = "/cgi-bin/target.cgi"; // cgi's name $string = "value1=value1value2=value2" ; // There can be more value PostToHost("$host","$patha","$string"); // call the function ? -Original Message- From: Montgomery-Recht, Evan [mailto:[EMAIL PROTECTED]] Sent: Monday, February 19, 2001 2:06 PM To: [EMAIL PROTECTED] Subject: [PHP] HTTP POST Question Good morning... This should be a good monday morning question. I have a cgi-bin written in perl (it's actually, a interface to a perl-module which is a interface to a telnet-like protocol). Anyways what I need to do is I have already existing code written in PHP, but at some point I need to call this cgi-bin and get a return code from it and process (good/bad result) and return to completed php script that says it called this cgi-bin. It's not very clear how to set the HTTP_POST_VARS for sending to a post command (which doesn't seem to exist); Any ideas I don't see a function called: $HTTP_POST_VARS =set variables; $result = http_post("http://localhost/cgi-bin/script.pl"); Thanks, evan PS. I'd appricate a working example, even if it's a dummy version. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] HTTP POST Question
I see the basic's... but... It's not completely clear from what I'm seeing. 1. It appears if I use the header function I have to redirect the page to another page, it doesn't appear possible to retrieve a page into the current page? Unless someone can show me some code that would do that. 2. it's not clear how you would actually set the HTTP_POST_VARS's and when you use the header("Request-URI:"); if that uses the HTTP_POST_VARS? as of right now it looks like the code would go as follows: ?php $HTTP_POST_VARS (not sure how to set these Something like this $HTTP_POST_VARS['uid']="userid"; ) header("Request-URI: http://localhost/cgi-bin/script.pl"); ? Is that all that has to be done? thanks, evan -Original Message- From: Milan Mlynarcik [SMTP:[EMAIL PROTECTED]] Sent: Monday, February 19, 2001 7:33 AM To: Montgomery-Recht, Evan Subject: Re: [PHP] HTTP POST Question You have to use header() function and how POST work you can find in HTTP RFC at http://www.w3.org/Protocols/rfc2616/rfc2616.html - Milan Mlynarcik Web Programmer Charmed Technology Slovakia Nam. sv. Egidia 16/37 058 01 Poprad, Slovakia E-mail: [EMAIL PROTECTED] Office: 00421 92 7881 874 Mobile: 00421 905 964 535 Web page: http://www.charmed.com/ - - Original Message - From: "Montgomery-Recht, Evan" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, February 19, 2001 1:06 PM Subject: [PHP] HTTP POST Question Good morning... This should be a good monday morning question. I have a cgi-bin written in perl (it's actually, a interface to a perl-module which is a interface to a telnet-like protocol). Anyways what I need to do is I have already existing code written in PHP, but at some point I need to call this cgi-bin and get a return code from it and process (good/bad result) and return to completed php script that says it called this cgi-bin. It's not very clear how to set the HTTP_POST_VARS for sending to a post command (which doesn't seem to exist); Any ideas I don't see a function called: $HTTP_POST_VARS =set variables; $result = http_post("http://localhost/cgi-bin/script.pl"); Thanks, evan PS. I'd appricate a working example, even if it's a dummy version. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] HTTP POST Question
OK, any idea's on a good tutorial on how to create the socket to do a HTTP_POST? thanks, evan PS. My girlfriend always complains when I send back one line e-mail's. Now I understand why. -Original Message- From: Milan Mlynarcik [SMTP:[EMAIL PROTECTED]] Sent: Monday, February 19, 2001 9:06 AM To: Montgomery-Recht, Evan Subject: Re: [PHP] HTTP POST Question You can do it with socket functions. - Milan Mlynarcik Web Programmer Charmed Technology Slovakia Nam. sv. Egidia 16/37 058 01 Poprad, Slovakia E-mail: [EMAIL PROTECTED] Office: 00421 92 7881 874 Mobile: 00421 905 964 535 Web page: http://www.charmed.com/ - - Original Message - From: "Montgomery-Recht, Evan" [EMAIL PROTECTED] To: "'Milan Mlynarcik'" [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Monday, February 19, 2001 2:06 PM Subject: RE: [PHP] HTTP POST Question I see the basic's... but... It's not completely clear from what I'm seeing. 1. It appears if I use the header function I have to redirect the page to another page, it doesn't appear possible to retrieve a page into the current page? Unless someone can show me some code that would do that. 2. it's not clear how you would actually set the HTTP_POST_VARS's and when you use the header("Request-URI:"); if that uses the HTTP_POST_VARS? as of right now it looks like the code would go as follows: ?php $HTTP_POST_VARS (not sure how to set these Something like this $HTTP_POST_VARS['uid']="userid"; ) header("Request-URI: http://localhost/cgi-bin/script.pl"); ? Is that all that has to be done? thanks, evan -Original Message- From: Milan Mlynarcik [SMTP:[EMAIL PROTECTED]] Sent: Monday, February 19, 2001 7:33 AM To: Montgomery-Recht, Evan Subject: Re: [PHP] HTTP POST Question You have to use header() function and how POST work you can find in HTTP RFC at http://www.w3.org/Protocols/rfc2616/rfc2616.html - Milan Mlynarcik Web Programmer Charmed Technology Slovakia Nam. sv. Egidia 16/37 058 01 Poprad, Slovakia E-mail: [EMAIL PROTECTED] Office: 00421 92 7881 874 Mobile: 00421 905 964 535 Web page: http://www.charmed.com/ - - Original Message - From: "Montgomery-Recht, Evan" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, February 19, 2001 1:06 PM Subject: [PHP] HTTP POST Question Good morning... This should be a good monday morning question. I have a cgi-bin written in perl (it's actually, a interface to a perl-module which is a interface to a telnet-like protocol). Anyways what I need to do is I have already existing code written in PHP, but at some point I need to call this cgi-bin and get a return code from it and process (good/bad result) and return to completed php script that says it called this cgi-bin. It's not very clear how to set the HTTP_POST_VARS for sending to a post command (which doesn't seem to exist); Any ideas I don't see a function called: $HTTP_POST_VARS =set variables; $result = http_post("http://localhost/cgi-bin/script.pl"); Thanks, evan PS. I'd appricate a working example, even if it's a dummy version. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] HTTP POST Question
I've been struggling with the same idea. I haven't been able to process the returned value, but I've the following methods to DISPLAY the cgi results. Although, the PHP has no way of knowing wether the CGI evaluated to a Yes or No result. If you solve this, then please let me know. $server = "http://www.mydomain_name.com/my_cgi_file.cgi?var1=valueOnevar2=valueTWO"; //var1 and var2 are the parameters that you are passing to the CGI for processing. //your cgi would process these variables, then 1) print out the result 2) return the desired variable...like, return ($var1, $var2). //open remote site $fp = fopen($server, "r"); fpassthrough($fp); //this will display whatever the remote CGI sends to STDOUT //however, it will not process anything that is returned. That is, the PHP doesn't know wether the CGI evaluated to GOOD or BAD. That's as far as I've been able to get, I hope it helps. If you do find a better solution, then please send me a copy. I would appreciate it. __John Monfort_ _+---+_ P E P I E D E S I G N S www.pepiedesigns.com "The world is waiting, are you ready?" -+___+- On Mon, 19 Feb 2001, Montgomery-Recht, Evan wrote: Good morning... This should be a good monday morning question. I have a cgi-bin written in perl (it's actually, a interface to a perl-module which is a interface to a telnet-like protocol). Anyways what I need to do is I have already existing code written in PHP, but at some point I need to call this cgi-bin and get a return code from it and process (good/bad result) and return to completed php script that says it called this cgi-bin. It's not very clear how to set the HTTP_POST_VARS for sending to a post command (which doesn't seem to exist); Any ideas I don't see a function called: $HTTP_POST_VARS =set variables; $result = http_post("http://localhost/cgi-bin/script.pl"); Thanks, evan PS. I'd appricate a working example, even if it's a dummy version. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] HTTP POST Question
1. It appears if I use the header function I have to redirect the page to another page, it doesn't appear possible to retrieve a page into the current page? Unless someone can show me some code that would do that. If all you want is to display the remote page, within the local page, then all you need is fpassthru() ex. $server = "http://www.site.com"; $fp = fopen($server,"r")// "r" is for reading fpassthru($fp); This will display the results of the remote file (html or whatever) into the local file (in this case, your PHP file). -Original Message- From: Milan Mlynarcik [SMTP:[EMAIL PROTECTED]] Sent: Monday, February 19, 2001 7:33 AM To: Montgomery-Recht, Evan Subject: Re: [PHP] HTTP POST Question You have to use header() function and how POST work you can find in HTTP RFC at http://www.w3.org/Protocols/rfc2616/rfc2616.html - Milan Mlynarcik Web Programmer Charmed Technology Slovakia Nam. sv. Egidia 16/37 058 01 Poprad, Slovakia E-mail: [EMAIL PROTECTED] Office: 00421 92 7881 874 Mobile: 00421 905 964 535 Web page: http://www.charmed.com/ - - Original Message - From: "Montgomery-Recht, Evan" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, February 19, 2001 1:06 PM Subject: [PHP] HTTP POST Question Good morning... This should be a good monday morning question. I have a cgi-bin written in perl (it's actually, a interface to a perl-module which is a interface to a telnet-like protocol). Anyways what I need to do is I have already existing code written in PHP, but at some point I need to call this cgi-bin and get a return code from it and process (good/bad result) and return to completed php script that says it called this cgi-bin. It's not very clear how to set the HTTP_POST_VARS for sending to a post command (which doesn't seem to exist); Any ideas I don't see a function called: $HTTP_POST_VARS =set variables; $result = http_post("http://localhost/cgi-bin/script.pl"); Thanks, evan PS. I'd appricate a working example, even if it's a dummy version. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]