Skip to content

Instantly share code, notes, and snippets.

@psahalot
Created February 25, 2014 18:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save psahalot/9214873 to your computer and use it in GitHub Desktop.
Save psahalot/9214873 to your computer and use it in GitHub Desktop.
<?php
/*
This file is for skin specific customizations. Be careful not to change your skin's skin.php file as that will be upgraded in the future and your work will be lost.
If you are more comfortable with PHP, we recommend using the super powerful Thesis Box system to create elements that you can interact with in the Thesis HTML Editor.
*/
add_action("gform_post_submission", "set_post_content", 10, 2);
function set_post_content($entry, $form)
{
//Gravity Forms has validated the data
//Our Custom Form Submitted via PHP will go here
// Lets get the IDs of the relevant fields and prepare an email message
$message = print_r($entry, true);
// In case any of our lines are larger than 70 characters, we should use wordwrap()
$message = wordwrap($message, 70);
// Send
//mail('pop3.pranjal@gmail.com', 'Getting the Gravity Form Field IDs', $message);
//Prepare to SEND DATA TO HOSTEDIVR.IN
function post_to_url($url, $data)
{
$fields = '';
foreach($data as $key => $value)
{
$fields .= $key . '=' . $value . '&';
}
rtrim($fields, '&');
$post = curl_init();
curl_setopt($post, CURLOPT_URL, $url);
curl_setopt($post, CURLOPT_POST, count($data));
curl_setopt($post, CURLOPT_POSTFIELDS, $fields);
curl_setopt($post, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($post);
curl_close($post);
}
if($form["id"] == 1)
{
$data = array("looking_for" => $entry["1"],
"c_name" => $entry["3"],
"email" => $entry["4"],
"phone" => $entry["5"],
"date_of_wedding" => $entry["7"],
"country" => $entry["8"],
"destination" => $entry["10"],
"no_of_guest" => $entry["11"],
"check_in_date" => $entry["12"],
"check_out_date" => $entry["13"],
"hotel_type" => $entry["14"],
"no_of_rooms" => $entry["15"],
"hotel_budget" => $entry["16"],
"welcome_lunch_dinner" => $entry["17.1"],
"Mehndi" => $entry["17.2"],
"Sangeet" => $entry["17.3"],
"wedding_ceremony" => $entry["17.4"],
"reception_dinner" => $entry["17.5"],
"beach_party" => $entry["17.6"],
"total_budget" => $entry["18"],
"anywhere_in_rajasthan" => $entry["19.1"],
"Chennai" => $entry["19.2"],
"Goa" => $entry["19.3"],
"Jaipur" => $entry["19.4"],
"Jaisalmer" => $entry["19.5"],
"Jodhpur" => $entry["19.6"],
"Kerala" => $entry["19.7"],
"Udaipur" => $entry["19.8"],
"any_other" => $entry["19.9"],
"not_sure" => $entry["19.11"],
"sch_call_date" => $entry["21"],
"consultation_type" => $entry["22"],
"details" => $entry["23"]
);
post_to_url("https://www.hostedivr.in/regal/getdata.php", $data);
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment