Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- string(341) "Can't use an undefined value as an ARRAY reference at /opt/rt4/share/html/REST/1.0/dhandler line 189.
- Stack:
- [/opt/rt4/share/html/REST/1.0/dhandler:189]
- [/opt/rt4/share/html/REST/1.0/autohandler:54]
- [/opt/rt4/sbin/../lib/RT/Interface/Web.pm:634]
- [/opt/rt4/sbin/../lib/RT/Interface/Web.pm:334]
- [/opt/rt4/share/html/autohandler:53]
- import cookielib
- import urllib
- import urllib2
- # creates a cookie for the rtserver with the credentials given at initialization.
- # define your credentials here
- # here is the RequestTracker URI we try to access
- uri = 'http://ip:port/REST/1.0/ticket/1/edit?user=username&pass=password'
- # trying login on rt server
- cj = cookielib.LWPCookieJar()
- opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
- urllib2.install_opener(opener)
- subdata = {'Subject': 'Test2', "Status":"open"}
- data = {'content':subdata}
- ldata = urllib.urlencode(data)
- login = urllib2.Request(uri, ldata)
- print(login.get_full_url())
- try:
- response = urllib2.urlopen(login)
- print response.read()
- except urllib2.URLError:
- # could not connect to server
- print "Not able to login"
- <?php
- require('HttpRequest.php');
- $username = 'username';
- $password = 'password';
- //set POST variables
- $url = "http://ip:port/REST/1.0/ticket/1/edit?user=$username&pass=$password";
- $fields = array("content"=>"Subject=Test2nStatus=openn");
- $request = new HttpRequest('post', $url, $fields);
- print($request->toString());
- $request->doRequest();
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement