Jump to content

Archived

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

jmilane

cURL help needed... in over my little head...

Recommended Posts

Hi,

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 oldserver.mycompany.com.

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 tried to do something with cURL:

[code]
$ch = curl_init("http://oldserver.mycompany.com/somepage.php");
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
[/code]

But now I find out that CURLOPT_POSTFIELDS wants a string.

Some of my $_POST variables are arrays. I think one is even an array of arrays.

So now I have a new question...

How can I go through $_POST and serialize() it, (is this even what I want to do??) and create a string that I can use with CURLOPT_POSTFIELDS?

Mind you, I have been using PHP for a month

If I am way off base, I sincerely apologize.

I am also sincerely grateful for your time. I have been banging my head against the wall with this.

Oh yeah... does PHP need to have cURL enabled on the machine that receives this request?

Thanks a million... really... I feel awful asking this compound question.

J

Share this post


Link to post
Share on other sites
Seems like a stupid question, but the old box is still serving pages on http://oldserver.mycompany.com/ across the LAN isn't it  ;)

Regards
Huggie

Share this post


Link to post
Share on other sites

×

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.