Guest User

Untitled

a guest
Apr 21st, 2018
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  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. ));
Add Comment
Please, Sign In to add comment