A wordpress form to post information on an external phplist url using plugins

41 views Asked by At

I need to make a form page on my website called www.doubleview.ca which is in wordpress. The posted data will be then posted on another site on the same server here .

I would like user not to leave the original site and errors and success to be posted right at the same location.

I am looking for a form plug in with this ability.

Thank you for the help

1

There are 1 answers

0
Sajid anwar On

Please read about curl I have not know more. The CURLOPT_URL you can set your remote site file url where this data will submit. And create file in your main site and you can get normal $_POST array.

$post_arr = $_POST; // you can set here your array 
$ch = curl_init();
 curl_setopt($ch, CURLOPT_URL, stripslashes('full path of your file where you have'));
 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
 curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
 curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
 curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post_arr));
 curl_setopt($ch, CURLOPT_TIMEOUT, 10);
 $httpCode = curl_getinfo($ch , CURLINFO_HTTP_CODE); // this results 0 every time
 $response = curl_exec($ch);
 if ($response === false) $response = curl_error($ch);
 curl_close($ch);