Advertisement
Guest User

Untitled

a guest
Sep 4th, 2016
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. <?php
  2.  
  3.  
  4.  
  5. $username = '******';
  6.  
  7. $password = '*****';
  8.  
  9.  
  10.  
  11. $url = "https://jira.*****/rest/api/2/search?jql=****";
  12.  
  13. $ch = curl_init();
  14.  
  15.  
  16.  
  17. $headers = array(
  18.  
  19. 'Accept: application/json',
  20.  
  21. 'Content-Type: application/json'
  22.  
  23. );
  24.  
  25.  
  26.  
  27. $test = "This is the content of the custom field.";
  28.  
  29.  
  30.  
  31. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  32.  
  33. curl_setopt($ch, CURLOPT_VERBOSE, 1);
  34.  
  35. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
  36.  
  37. curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
  38.  
  39. curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
  40.  
  41. curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
  42.  
  43. //curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
  44.  
  45. curl_setopt($ch, CURLOPT_URL, $url);
  46.  
  47. curl_setopt($ch, CURLOPT_USERPWD, "$username:$password");
  48.  
  49.  
  50.  
  51. $result = curl_exec($ch);
  52. $ch_error = curl_error($ch);
  53.  
  54. if ($ch_error) {
  55.  
  56. echo "cURL Error: $ch_error";
  57.  
  58. } else {
  59.  
  60. $phpData = json_decode($result);
  61. foreach($phpData->issues as $issue){
  62. print_r($issue)
  63. }
  64. }
  65. curl_close($ch);
  66. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement