I have a client that transitioned to Infusionsoft. They have web forms in modals/lightboxes in their Wordpress site. When the web form is submitted, the form should be processed and the ‘thank you’ message should appear in the modal. This is accomplished through an iframe. Because Infusionsoft form processing busts out of the iframe, I’ve had to submit the forms to a PHP page that then posts to Infusionsoft. I used the code below using Curl, but our IP gets blacklisted. How would I go about posting the page using the Encrypted API key and passphrase instead of using Curl? Code for reference:
<?php
// extract data from the post
extract($_POST);
// set POST variables
$fields = array(
‘inf_form_xid’ => urlencode( $inf_form_xid ),
‘inf_form_name’ => urlencode( $inf_form_name ),
‘infusionsoft_version’ => urlencode( $infusionsoft_version ),
‘inf_field_FirstName’ => urlencode( $firstName ),
‘inf_field_LastName’ => urlencode( $lastName ),
‘inf_field_Company’ => urlencode( $company ),
‘inf_field_Email’ => $emailAddress,
‘inf_field_Phone1’ => urlencode( $busPhone ),
‘inf_field_phonymail’ => $email,
);
if (empty($fields[inf_field_phonymail])) {
// url-ify the data for the POST
$fields_string = http_build_query($fields);
$url = ‘https://po353.infusionsoft.com/app/form/process/’ . $inf_form_xid;
//open connection
$ch = curl_init();
//set the url, number of POST vars, POST data
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);/* set as true rather than a number /
/ use http_build_query
to construct data to send */
curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string );
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($ch, CURLOPT_USERAGENT, “Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)”);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
//execute post
$result = curl_exec($ch);
//close connection
curl_close($ch);
$typ = array(“4d0144008462cf877bda774a33944c86”=>“Chris White”, “fde0b898d765497c91b5e42f5dbd2f95”=>“Stanley Leone Jr.”, “1225dca27ccdef06cc967c7f5c0c79bd”=>“Lyle Wells”,“ebb2285f51afd0c4ed2bf28a2226817b”=>“Flip Flippen”,“64f004347bc098ed65a2c868cb3280c2”=>“Lt. Gen. (RET) R. L. Van Antwerp”);
$thank_you_message = '
/* write success message back into the modal */
echo $thank_you_message;
}
?>