Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/294.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 请求跟踪器(RT)REST API内容错误_Php_Python_Rest_Httprequest_Rt - Fatal编程技术网

Php 请求跟踪器(RT)REST API内容错误

Php 请求跟踪器(RT)REST API内容错误,php,python,rest,httprequest,rt,Php,Python,Rest,Httprequest,Rt,我曾经尝试过以多种方式发布HTTP请求(使用PHP和Python),但我一直遇到这个错误 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/auto

我曾经尝试过以多种方式发布HTTP请求(使用PHP和Python),但我一直遇到这个错误

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]
我试图遵循,但我似乎无法安装他们正在使用的HttpRequest,我无法找到它的源代码在线

有人有什么建议吗

以下是我的python代码:

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:

<?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=Test2\nStatus=open\n");

$request = new HttpRequest('post', $url, $fields);
print($request->toString());
$request->doRequest();
?>


来自

的HttpRequest解决了问题吗?解决了问题吗?