Advertisement
Guest User

Untitled

a guest
Sep 14th, 2016
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. $url ="http://localhost:8080/bugzilla/rest/bug";
  2. $apikey = "IZC4rs2gstCal0jEZosFjDBRV9AQv2gF0udh4hgq";
  3. $data = array(
  4. "product" => "TestProduct",
  5. "component" => "TestComponent",
  6. "version" => "unspecified",
  7. "summary" => "This is a test bug - please disregard",
  8. "alias" => "SomeAlias",
  9. "op_sys" => "All",
  10. "priority" => "P1",
  11. "rep_platform" => "All"
  12. );
  13.  
  14. $str_data = json_encode($data);
  15.  
  16. $ch = curl_init($url);
  17. curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
  18. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  19. curl_setopt($ch, CURLOPT_POSTFIELDS,$str_data);
  20. curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
  21. curl_setopt($ch, CURLOPT_HTTPHEADER,
  22. array("Content-Type: application/json", "Accept: application/json"));
  23. $username = "ashish.sureka@in.abb.com";
  24. $password = "abbincrc";
  25. curl_setopt($ch, CURLOPT_USERPWD, $username.":".$password);
  26. $result = curl_exec($ch);
  27. curl_close($ch);
  28.  
  29. echo $result
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement