Jump to content

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


jmilane

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
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.