Advertisement
Guest User

Untitled

a guest
Oct 4th, 2018
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. <?php
  2.  
  3.  
  4. $WEBDAV_USER="myUser";
  5. $WEBDAV_PASSWORD="myPwd";
  6. $WEBDAV_BASE_URL="myUrl";
  7. $WEBDAV_DOCUMENT_ID="01";
  8.  
  9. public function getDocumentById($id)
  10. {
  11. try {
  12.  
  13. $ch = curl_init();
  14. curl_setopt($ch, CURLOPT_URL, $WEBDAV_BASE_URL+$WEBDAV_DOCUMENT_ID);
  15. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  16. curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
  17. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  18. curl_setopt($ch, CURLOPT_USERPWD, "$WEBDAV_USER:$WEBDAV_PASSWORD");
  19. curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
  20.  
  21. $output = curl_exec($ch);
  22. return $output;
  23. curl_close($ch);
  24.  
  25. } catch (\Exception $e) {
  26. echo "this seems broken";
  27. }
  28.  
  29. }
  30.  
  31. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement