daily pastebin goal
62%
SHARE
TWEET

Untitled

a guest Jan 28th, 2016 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3.     $username = "user";
  4.     $password = "password";
  5.  
  6.     $postData = array(
  7.             'username' => $username,
  8.             'password' => $password,
  9.             'msisdn' => "111111111"
  10.             );
  11.  
  12.     $ch = curl_init('http://ip:<port>/xxx/yyy/zzz');
  13.  
  14.     curl_setopt_array($ch, array(
  15.     CURLOPT_POST => TRUE,
  16.     CURLOPT_RETURNTRANSFER => TRUE,
  17.     CURLOPT_HTTPHEADER => array(
  18.         'Content-Type: application/json'
  19.     ),
  20.     CURLOPT_POSTFIELDS => json_encode($postData)
  21.     ));
  22.  
  23.     // Send the request
  24.     $response = curl_exec($ch);
  25.  
  26.     // Check for errors
  27.     if($response === FALSE){
  28.     die(curl_error($ch));
  29.     }
  30.  
  31.     // Decode the response
  32.     $responseData = json_decode($response, TRUE);
  33.  
  34.     // Print the date from the response
  35.     echo $responseData['published'];
  36.  
  37.     var_dump($responseData);
  38.  
  39.     ?>
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