Guest User

Trying to pass new client to WHMCS

a guest
Feb 11th, 2013
261
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.00 KB | None | 0 0
  1. <?php
  2. add_action("gform_post_submission", "set_post_content", 10, 2);
  3.  function set_post_content($entry, $form){
  4.  
  5.  function post_to_url($url, $data) {
  6.  $fields = '';
  7.  foreach($data as $key => $value) {
  8.  $fields .= $key . '=' . $value . '&';
  9.  }
  10.  rtrim($fields, '&');
  11.  
  12.  $post = curl_init();
  13.  
  14.  curl_setopt($post, CURLOPT_URL, $url);
  15.  curl_setopt($post, CURLOPT_POST, count($data));
  16.  curl_setopt($post, CURLOPT_POSTFIELDS, $fields);
  17.  curl_setopt($post, CURLOPT_RETURNTRANSFER, 1);
  18.  
  19.  $result = curl_exec($post);
  20.  
  21.  curl_close($post);
  22.  }
  23.  
  24.  if($form["id"] == 3){//Full Registration
  25.  
  26.  $data = array(
  27.  "firstname" =>  $entry["1.3"],
  28.  "lastname" =>   $entry["1.6"],
  29.  "email" =>       $entry["2"],
  30.  "address1" =>    $entry["3.1"],
  31.  "city" =>        $entry["3.3"],
  32.  "state" =>       $entry["3.4"],
  33.  "postcode" =>    $entry["3.5"],
  34.  "country" =>     $entry["3.6"],
  35.  "phonenumber" => $entry["4"],
  36.  "password2" => $entry["3.2"]
  37.  );
  38.  
  39.  post_to_url("http://microbop.com/", $data);
  40.  
  41.  }
  42. }
  43.  ?>
Advertisement
Add Comment
Please, Sign In to add comment