Advertisement
Guest User

Untitled

a guest
Aug 1st, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.44 KB | None | 0 0
  1. string(341) "Can't use an undefined value as an ARRAY reference at /opt/rt4/share/html/REST/1.0/dhandler line 189.
  2.  
  3. Stack:
  4. [/opt/rt4/share/html/REST/1.0/dhandler:189]
  5. [/opt/rt4/share/html/REST/1.0/autohandler:54]
  6. [/opt/rt4/sbin/../lib/RT/Interface/Web.pm:634]
  7. [/opt/rt4/sbin/../lib/RT/Interface/Web.pm:334]
  8. [/opt/rt4/share/html/autohandler:53]
  9.  
  10. import cookielib
  11. import urllib
  12. import urllib2
  13.  
  14. # creates a cookie for the rtserver with the credentials given at initialization.
  15. # define your credentials here
  16.  
  17. # here is the RequestTracker URI we try to access
  18. uri = 'http://ip:port/REST/1.0/ticket/1/edit?user=username&pass=password'
  19.  
  20. # trying login on rt server
  21. cj = cookielib.LWPCookieJar()
  22. opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
  23. urllib2.install_opener(opener)
  24. subdata = {'Subject': 'Test2', "Status":"open"}
  25. data = {'content':subdata}
  26. ldata = urllib.urlencode(data)
  27. login = urllib2.Request(uri, ldata)
  28. print(login.get_full_url())
  29. try:
  30. response = urllib2.urlopen(login)
  31. print response.read()
  32.  
  33. except urllib2.URLError:
  34. # could not connect to server
  35. print "Not able to login"
  36.  
  37. <?php
  38. require('HttpRequest.php');
  39. $username = 'username';
  40. $password = 'password';
  41. //set POST variables
  42. $url = "http://ip:port/REST/1.0/ticket/1/edit?user=$username&pass=$password";
  43. $fields = array("content"=>"Subject=Test2nStatus=openn");
  44.  
  45. $request = new HttpRequest('post', $url, $fields);
  46. print($request->toString());
  47. $request->doRequest();
  48. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement