Jump to content

POSTing without using a form, and redirecting as well


luckyass

Recommended Posts

For a number of reasons, I can not change the Matt's archive formail.pl to a php mail script.And, I do not know PERL.

 

Becuase I want the POST data from my form to do more than just be emailed, I am trying to write a php script, which will process the data the way i want it to, and then redirect to the orginal formail.pl to be processed.

 

How do i redrect a PHP page to a PERL script and carry with it the POST method and all the variables?

 

 

 

 

What exactly are you trying to do with the POST variables before sending them off with email?  In the formmail.pl script there is a section which redirects the user on success, you may be able to interpret that into doing what you want.

 

I'd personally just not use the formmail.pl script because you could then just use php mail() to send mail at any point in your script and use the variables to do whatever else you want too.

I am a little confused.. your title says POSTing without using a form but in your body you say you want to use the POST data from your form.  :confused:

 

It would help to know how you implement the formail.pl normally.  I do not know perl but from what I understand there are a few methods to call perl scripts. 

 

I found this when I googled call perl from php

 

Executing Perl Scripts Inside of PHP Scripted Pages

To execute perl scripts from inside PHP-scripted pages, use the following code:

<?php virtual ("../path/to/script.cgi"); ?>

 

It seems suspiciously easy so I would read about a few different methods.  I think the perl scripts can be called though exec functions too.  If this situation is correct the I would suggest that you do all your processing of the post data on the page that your form action is directed to and then just execute/call the perl script from the same page rather then redirecting the page somewhere else.

 

If you have to so some redirecting it could be a little trickier.  You could bone up on fopen functions and that would probably provide you with a solution for posting and redirecting. 

 

To find a good example of how to send data from one place to another download the Paypal developer SDK and take a look at the PHP sample code for posting data to paypal from your server. 

 

I wish I could be of more help but I am not an expert on using perl with php.  If you have access to PECL extension then it should be pretty easy to do what you want.

 

If you call the Perl script like an executable I see no reason that you couldn't do it all on one page.  It would be a lot simpler too.

Thank you... I think you are not confused, and you understand what I am trying to do. I titled it the way I did because of the logic I was using. Initially, I am posting from a form, but once the php document is opened, I want to POST without using a form to the PERL script... its a riddle, wrapped inside an enigma, wrapped inside...

 

But I think the logic you worked out for me to call the PERL script from the PHP is the best idea.

 

The other way you suggest, using fopen, I researched extensively, and only got more and more confused...there was lots of info on how to POST without using a form, but nothing about redirecting the header at the same time.

 

I will post again here if/when i get it working.

 

Thanks for the help!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.