Codeigniter 使用PHP通过Rest登录Bugzilla

Codeigniter 使用PHP通过Rest登录Bugzilla,codeigniter,bugzilla,Codeigniter,Bugzilla,我想在php代码中使用REST登录并验证用户数据。 任何人都可以帮助我,我试图阅读Bugzilla API的文档,但我不知道如何应用它。 我正在使用codeigniter,这是我最后一次测试url function createIssue_get() { $client_data = array( 'application_id' => 1, 'ios' => "IOS", 'type' => "dsfs",

我想在php代码中使用REST登录并验证用户数据。 任何人都可以帮助我,我试图阅读Bugzilla API的文档,但我不知道如何应用它。 我正在使用codeigniter,这是我最后一次测试url

  function createIssue_get() {

    $client_data = array(
        'application_id' => 1,
        'ios' => "IOS",
        'type' => "dsfs",
        'memory' => "32",
        'storage' => "32",
        'wifi' => "dsfd",
        'carrier' => "erwre",
        'battery_level' => "32423",
        'battery_state' => "erwwer",
        'country' => "ewre",
        'city' => "ewrwre",
        'console_log' => "drewrwer",
        'duration' => "werwere",
        'created_at' => date("Y-m-d H:i:s", now())
    );

    $username = 'xxxxxxx@gmail.com';
    $password = 'xxxxxxxx';
    $curl_handle = curl_init();
    curl_setopt($curl_handle, CURLOPT_HTTPHEADER, array("Content-Type: application/json", "Accept: application/json"));
    curl_setopt($curl_handle, CURLOPT_URL, 'https://api-dev.bugzilla.mozilla.org/test/latest/bug?username=xxxxx@gmail.com&password=xxxxxxx');
    curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($curl_handle, CURLOPT_SSL_VERIFYHOST, 0); 
    curl_setopt($curl_handle, CURLOPT_SSL_VERIFYPEER, 0); 

    curl_setopt($curl_handle, CURLOPT_POST, 1);
    curl_setopt($curl_handle, CURLOPT_POSTFIELDS, json_encode(array(
                'product' => 'MyOwnBadSelf',
                'summary' => substr('testing', 0, 20),
                'version' => 'unspecified',
                'component' => 'Comp1',
                'op_sys' => "All",
                'platform' => "Macintosh",
                'priority' => "P5",
                'severity' => "Trivial",
                'whiteboard' => implode('', $this->array_map_assoc(function($k, $v) {
                                    return "$k:\n$v\n\n";
                                }, $client_data))
            )));

    curl_setopt($curl_handle, CURLOPT_USERPWD, $username . ':' . $password);  
    $buffer = curl_exec($curl_handle);

    curl_close($curl_handle);

    echo $buffer;

}

它适用于创建bug,但我只需要验证用户名并通过

不确定我是否正确理解您的问题,但如果您试图将REST与CI一起使用,这是Phil Sturgeon制作的一个很酷的插件:


我的问题是,我需要在搜索后使用REST API向bugzilla报告一个bug,我可以在Buzilla的测试服务器上找到它,但使用bugzilla的实际应用程序。。。像我一样工作,我需要知道如何处理