daily pastebin goal
22%
SHARE
TWEET

Untitled

a guest Aug 17th, 2018 70 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. <?php
  3.  
  4. if(isset($_POST['submit'])) {
  5.     //form's fields name:
  6.     $name = $_POST['nome'];
  7.     $email = $_POST['email'];
  8.  
  9.     //API url:
  10.     $url = 'https://panel.kloudymail.com/subscriber/create/';
  11.    
  12.    
  13.    
  14.  
  15.    
  16.     $data = array(
  17.         'NOME' => $name,
  18.         'KM_RECIPIENT' => $email
  19.         //"account_code": "95031C8E-3F59-4842-A7E7-272BA0D7054C",
  20.         //"list_code": "73C926A0-E6FC-4A50-B127-C46C04FB7FF0"
  21.     );
  22.  
  23.     //sending request (according to prosperworks documentation):
  24.     // use key 'http' even if you send the request to https://...
  25.     $options = array(
  26.         'http' => array(
  27.             'header'  => "Content-Type: application/json; charset=UTF-8".
  28.             "Authorization: Bearer dea8d0908678147508e89ad7646092dcc6fe1e84",
  29.             'method'  => 'POST',
  30.             'content' => json_encode($data)
  31.         )
  32.     );
  33.  
  34.     //engine:
  35.     $context  = stream_context_create($options);
  36.     $result = file_get_contents($url, false, $context);
  37.     if ($result === FALSE) { /* Handle error */ }
  38.     //compiling to JSON (as wrote above):
  39.     $resultData = json_decode($result, TRUE);
  40.     //display what was sent:
  41.     //echo '<h2>Sent: </h2>';
  42.     //echo $resultData['published'];
  43.     //dump var:
  44.     //var_dump($result);
  45.  
  46. }
  47.  
  48.  
  49. echo '<pre>';
  50. var_dump($result);
  51. echo '</pre>';
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top