Guest User

Untitled

a guest
Jul 11th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. $url = "https://jira.account/secure/attachment/".$attachment_id."/".$attachment_name."?os_username=". $username ."&os_password=" . $password;
  2.  
  3. $ch = curl_init();
  4. curl_setopt($ch, CURLOPT_URL, $url);
  5. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  6. curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
  7. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  8. curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
  9.  
  10. $file = curl_exec($ch);
  11. curl_close($ch);
  12.  
  13. if($file){
  14. header('Content-Description: File Transfer');
  15. header('Content-Type: application/zip');
  16. header('Content-Disposition: attachment; filename='.$attachment_name);
  17. header('Expires: 0');
  18. header('Cache-Control: must-revalidate');
  19. header('Pragma: public');
  20. echo ($file);
  21. exit;
  22. }else{
  23. throw new Exception("Error: file now found.");
  24. }
Add Comment
Please, Sign In to add comment