Problem with the On submit Code, After Sending Email

wmuckell 09 Feb, 2011
I have been trying to use the CURL plugin, but without any luck at all.

Therefore I am attempting to use the On submit code to do the CURL php myself.

This is the code I am trying to use.
<?php
$ch = curl_init('https://**************************valid_form.php');

$id_form = "888";
$id_source "888";
$f_project_post_code = $_POST['Postcode'];
$f_civility = " ";
$f_first_name = " ";
$f_last_name = $_POST['name'];
$f_delay = "1";
$f_country = "0";
$f_kind = "b2c";
$f_address = $_POST['Postcode'];
$f_home_phone = $_POST['telephone'];
$f_mobile_phone = $_POST['telephone'];
$long_description = "The user selected the following".$_POST['Enlargement'];
$id_site = "888";
$token = "888";
$email = $_POST['email'];




curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt ($ch, CURLOPT_POST, 1);
curl_setopt ($ch, CURLOPT_POSTFIELDS, "id_site=$id_site
&token=$token
&action=submit
&id_form=$id_form
&id_source=$id_source
&email=$email
&f_project_post_code=$f_project_post_code
&f_civility=$f_civility
&f_first_name=$f_first_name
&f_last_name=$f_last_name
&f_delay=$f_delay
&f_country=$f_country
&f_kind=$f_kind
&f_address=$f_address
&f_mobile_phone=$f_mobile_phone
&long_description=long_description
&go=0");
$data = curl_exec($ch);
curl_close ($ch);
//print_r($data); 
?> 


However when I paste the code I get the following Server error message and really got no idea what to do next.

Forbidden

You don't have permission to access /administrator/index2.php on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
GreyHead 12 Feb, 2011
Hi wmuckell,

Hard to know what to say. I pasted your code into the OnSubmit box of a new form and don't get any error and the code looks OK - at least I don't see anything in there likely to trigger this error.

Do you get this if you edit other forms?

We've seen a sprinkling of index2.php reports recently - most often thet seem to result from mod_security settings that block the index2.php url.

What problem did you get with the cURL plug-in - it does more or less the same as you have here?

Bob
This topic is locked and no more replies can be posted.