daily pastebin goal
21%
SHARE
TWEET

Untitled

a guest Apr 21st, 2018 56 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. curl 'https://XXXXXXXX/login' -H 'Authorization: Basic XXXXXXXX=='
  2.       -H 'Content-Type: application/x-www-form-urlencoded'
  3.       --data 'username=XXXXXXXX&password=XXXXXXXX'
  4.    
  5. class XXXXXX {
  6.       function login($username='', $password='') {
  7.         // construct url - returns https://XXXXXXXX/login
  8.         $url = $this->constructLoginUrl();
  9.  
  10.         $data = array(
  11.           'username' => $username,
  12.           'password' => $password
  13.         );
  14.  
  15.         $headers = array(
  16.           'Authorization' => "Basic XXXXXXXX==",
  17.           'Content-Type'  => "application/x-www-form-urlencoded"
  18.         );
  19.  
  20.         $response = drupal_http_request( $url, $headers, 'POST', http_build_query( $data )    
  21.  
  22.         return $response;
  23.       }
  24.     }
  25.    
  26. drupal_http_request($url, array(
  27.   'headers' => $headers,
  28.   'method' => 'POST',
  29.   'data' => http_build_query($data)
  30. ));
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