Advertisement
Guest User

Untitled

a guest
Sep 19th, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. var username = "ant1";
  2. var password = "2015";
  3.  
  4. var url = 'https://test.ru/ajax.php';
  5. $.ajax({
  6. type: "PROPFIND",
  7. url: url,
  8. success: function(json) {
  9. alert("Success", json);
  10. },
  11. error: function(XMLHttpRequest, textStatus, errorThrown) {
  12. alert(textStatus, errorThrown);
  13. console.log(XMLHttpRequest);
  14. },
  15. beforeSend: function (xhr) {
  16. xhr.withCredentials = true;
  17. xhr.setRequestHeader ("withCredentials", "true");
  18. xhr.setRequestHeader ("Authorization", "Basic " + btoa(username + ":" + password));
  19. }
  20. });
  21.  
  22. var_dump($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']);
  23.  
  24. RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
  25.  
  26. curl --user username:password https://test.ru/ajax.php
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement