Advertisement
Guest User

Untitled

a guest
Feb 21st, 2018
305
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.57 KB | None | 0 0
  1. $name = "silviu";
  2. $lname = "nuta";
  3. $email = "testsilviu1234@test.com";
  4. $password = "123213";
  5. $phone = "972-9-222236427";
  6. $countryCode = "200";
  7.  
  8.   $url = "http://www.empireoption.com/api/";
  9.   $apiUserName = 'api_usr_traderleads';
  10.   $apiPassword = '5sNs92NurH';
  11.   $campaignId = '203';
  12.   $curr = 'EUR';
  13.  
  14.  
  15.   //Get country------------------------
  16.    $fields = array(
  17.    'MODULE' => 'Country',
  18.    'COMMAND' => 'view',
  19.    'FILTER[iso]' => 'IS',
  20.    'api_username' => $apiUserName, //The API Username
  21.    'api_password' => $apiPassword, //The API Password
  22.  
  23.  );
  24.  
  25.   $headers = array(
  26.     'Content-Type' => 'application/x-www-form-urlencoded',
  27.   );
  28.  
  29.     $fields_string = '';
  30.   //url-ify the data for the POST
  31.   foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; }
  32.   rtrim($fields_string, '&');
  33.   try{
  34.   $chCountry = curl_init();
  35.  
  36.    $headers = array(
  37.     'Content-Type' => 'application/x-www-form-urlencoded',
  38.   );
  39.  
  40.   //set the url, number of POST vars, POST data
  41.     curl_setopt($chCountry,CURLOPT_HTTPHEADER, $headers);
  42.     curl_setopt($chCountry,CURLOPT_URL, $url);
  43.     curl_setopt($chCountry, CURLOPT_RETURNTRANSFER, 1);
  44.     curl_setopt($chCountry, CURLOPT_HTTPGET, 1);
  45.  
  46.   $result = curl_exec($chCountry);
  47.   if (FALSE === $result)
  48.         throw new Exception(curl_error($chCountry), curl_errno($chCountry));
  49.     var_dump($result);
  50.   //close connection
  51.   curl_close($chCountry);
  52.   }catch(Exception $e) {
  53.  
  54.     trigger_error(sprintf(
  55.         'Curl failed with error #%d: %s',
  56.         $e->getCode(), $e->getMessage()),
  57.         E_USER_ERROR);
  58.  
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement