Forum Moderators: coopster

Message Too Old, No Replies

Submitting POST data without FORM

         

iansilber

9:45 pm on Mar 11, 2005 (gmt 0)

10+ Year Member



I have a form that routes to a PHP script that sends an email. I have this set up fine, but here's the tricky part:

I need to then have it send the same variables to a third-party script that will only accept POST variables, so the get method is out of the question.

Is there a way to do this?

Sorry if it's completely easy, I'm pretty much a noob.

iansilber

10:03 pm on Mar 11, 2005 (gmt 0)

10+ Year Member



Okay, well I found a way to do it, using cURL (which I do have installed on my server). Here's the code:

$URL="www.theurl.com/script.php"; 
$ch = curl_init();   
curl_setopt($ch, CURLOPT_URL,"https://$URL");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "email=$emailaddress&firstname=$firstname&lastname=$lastname");curl_exec ($ch);    
curl_close ($ch);

But when I do it, I get the following error message:

Parse error: parse error, unexpected T_STRING in /home/msilber/public_html/mailform.php on line 4

Line 4 is: curl_setopt($ch, CURLOPT_URL,"https://$URL");

I can't figure out what's wrong here. Anybody know?

badone

12:33 am on Mar 12, 2005 (gmt 0)

10+ Year Member



It doesn't seem to like your;

"https://$URL" parameter. Try hard-coding it for testing and see if that makes a difference.

Cheers,
BAD