Jump to content


Photo

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


  • Please log in to reply
1 reply to this topic

#1 jmilane

jmilane
  • New Members
  • Pip
  • Newbie
  • 8 posts

Posted 20 September 2006 - 10:28 AM

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:

$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 

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

#2 HuggieBear

HuggieBear
  • Members
  • PipPipPip
  • Advanced Member
  • 1,899 posts
  • LocationEngland, UK

Posted 20 September 2006 - 10:33 AM

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
Advice to MySQL users: Get phpMyAdmin and test your queries work there first, take half the hassle out of diagnosis, also check the reserved words list.

Links: PHP Docs :: RegEx's :: MySQL :: DevGuru :: w3schools




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users