need help with $_POST variables

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

I have a mysql box that has a private network ip. The old developer was
running our web server on this machine but the company since retired
the box and it is in a closet, still running, but sad and alone,
aliased as

Now I am finding out that I need to use some of the funcitonality in
the scripts that are on the old box.

So, I just installed PHP on our new IIS webserver.

I have a form that he built which collects information from potential
clients and then passes it on for entry in the database (on the old
box), sends out emails, does calculations, and so on and so forth. It
does a lot, actually.

I cannot build a form to pass directly to this mysql box because it
does not have a public IP. I cannot submit directly to a private IP.
Found this out recently.

So I was thinking I could have the form submit to our web server, and
they my web server could in turn submit the $_POST variables to the
private box.

This should work, no?

My problem is, I need to create a file on my web server that will do
nothing but take the $_POST variables and hand them off to the private
box for processing.

How can I take $_POST and repost it?

It is probably not difficult, but I am new to PHP. I have looked,
cannot find the answer.

I would not be able to press a button, so the submission would have to
be automatic.

Is this possible?

Can you help? I truly appreciate it. I need to get this up... as a
temporary solution... then I can try to duplicate the functionality on
the private box with the web server.

All I want to do is take the $_POST variables from the form and pass
them to an intermediary script that is able to talk to the private box,
and then have that intermediary script pass them along again as a
$_POST array.

Thanks a lot!!!!!!


Re: need help with $_POST variables wrote:
Quoted text here. Click to load it

Use the curl functions ( ).  Here's how:

$ch = curl_init(" ");
curl_setopt($ch, CURLOPT_POST); //use the POST method
curl_setopt($ch, CURLOPT_POSTFIELDS, $_POST); //take the $_POST array
and use those as the POST parameters for the curl request
curl_exec($ch); //execute the request

Re: need help with $_POST variables

I know nothing about cURL

guess Ill have to learn


Re: need help with $_POST variables

ZeldorBlat wrote:
Quoted text here. Click to load it

This is a great response. I really thank you for taking the time to
answer me.

Do both servers need to have curl enabled?

I am getting this error:

Warning: Wrong parameter count for curl_setopt() in D:\ULEM
WebSite\forms\middle.php on line 5 (This is the code above that you
Message was not sent
Please tell the Administrator: Mailer Error: Could not instantiate mail
function.PHP Warning: Cannot open 'C:\Program Files\PHP\extras' for
reading in Unknown on line 0

Re: need help with $_POST variables

Quoted text here. Click to load it

I have been told that CURLOPT_POSTFIELDS expects a string, so $_POST
will not work??? It also happens that many elements of my $_POST array
are arrays...

I am in over my head here...

I apologize for all the questions...

Re: need help with $_POST variables wrote:
Quoted text here. Click to load it

No, you can't use arrays - but then you can't send a PHP array in a  
header, anyway. You'll have to parse your $_POST array out into id/value  
pairs, just like you would see in a GET with parameters.

Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.

Re: need help with $_POST variables

Jerry Stuckle wrote:
Quoted text here. Click to load it

It depends on which version of PHP and curl you are using.  Some will
let you just give it an array.  You can always use http_build_query()
to make the conversion easy:

Site Timeline