Php Jenkins API访问被拒绝

Php Jenkins API访问被拒绝,php,jenkins,Php,Jenkins,我正在尝试通过Jenkins API将我的WordPress网站连接到我的jobs Jenkins。即使我看到很多帖子并尝试了它们,我仍然无法使我的Jenkins API正常工作 所以我在http://localhost:9090使用作业测试 我用我的用户名和密码在proxy:8080上配置了Jenkins的HTTP代理。当我在Jenkins中验证代理时,它是成功的 詹金斯还告诉我,我的代币从未使用过 关于我的API,我有: function getLastBuildStatus($url, $

我正在尝试通过Jenkins API将我的WordPress网站连接到我的jobs Jenkins。即使我看到很多帖子并尝试了它们,我仍然无法使我的Jenkins API正常工作

所以我在
http://localhost:9090
使用作业
测试

我用我的用户名和密码在
proxy:8080
上配置了Jenkins的HTTP代理。当我在Jenkins中验证代理时,它是成功的

詹金斯还告诉我,我的代币从未使用过

关于我的API,我有:

function getLastBuildStatus($url, $jobName, $username, $api_token){
    $password = 'xxxxx';
    $ch = initCurl($username, $api_token); //see function downside

    curl_setopt($ch, CURLOPT_URL, $url . '/job/' . $jobName . '/lastBuild/api/json');
    curl_setopt($ch, CURLOPT_PROXY, 'http://proxy:8080');
    curl_setopt($ch, CURLOPT_USERPWD, $username . ":" . $password); 

    $result = executeCurl($ch);
    $json = json_decode($result);
    var_dump ($result);
    if($json){
        return $json->result;
    }
    else {
        return -1;
    }

function initCurl($username, $api_token){
    $ch = curl_init();
    curl_setopt ( $ch, CURLOPT_SSL_VERIFYPEER, false ); 
    curl_setopt ( $ch, CURLOPT_SSL_VERIFYHOST, false ); 
    curl_setopt($ch, CURLOPT_USERPWD, $username . ":" . $api_token); 
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    return $ch;
}
无论是否使用代理,我都有一个
访问被拒绝
错误。我错过什么了吗

编辑1 我为Jenkins代理添加了
httpd.conf
规则。仍然是相同的错误,但可能需要更深入的研究

ProxyPass         /  http://localhost:9090/ nocanon
ProxyPassReverse  /  http://localhost:9090/
ProxyRequests     Off
AllowEncodedSlashes NoDecode
<Proxy http://localhost:9090/*>
  Order deny,allow
  Allow from all
</Proxy>
我不明白为什么,因为当我放入
curl\u setopt($ch,CURLOPT\u HTTPPROXYTUNNEL,false)时
在我的PHP文件中,我仍然得到
403错误


然而,当我放置
curl_setopt($ch,CURLOPT_PROXY,”)时,我收到一个
错误:无法连接到本地主机端口9090:连接被拒绝

尝试更改
$username。":" . $密码)
“$username:$password)”
仍然是相同的错误
拒绝访问
$api_令牌
正确吗?哪里定义了
$password
变量?
$password
是在函数中定义的,我编辑了帖子,我忘了它<代码>$api_令牌
是我在Jenkins中找到的令牌,因此是的,它必须是正确的。问题是整个错误是:
访问被拒绝。访问控制配置阻止此时允许您的请求。如果您觉得这不正确,请联系您的服务提供商。我的缓存管理员的姓名
。那一定是和代理有关吧?
curl  -v --noproxy localhost, http://localhost:9090/job/Test/api/json --user username:token