用标签提取数据到活跃的Collab任务 HTML-PHP[英] Extract Data to Active Collab Tasks with Tags HTML - PHP

本文是小编为大家收集整理的关于用标签提取数据到活跃的Collab任务 HTML-PHP的处理/解决方法,可以参考本文帮助大家快速定位并解决问题,中文翻译不准确的可切换到English标签页查看源文。

问题描述

我试图从API中提取数据以进行Active Collacon,但是在身体中存在的标签标签html,导致编码中的混乱,任何人都知道我能做什么?

我推动API的代码:

    try {
    function listTasks() {  

        $ch = curl_init();
        $token = 'token';
        curl_setopt_array($ch, [
            CURLOPT_URL => 'https://collab.cadastra.com.br/api/v1/projects/projectnumber/tasks/',

            CURLOPT_HTTPHEADER => [
                'X-Angie-AuthApiToken: ' . $token,
                'Content-Type: application/json',
                'x-li-format: json'
            ],
            CURLOPT_RETURNTRANSFER => true,
            CURLOPT_TIMEOUT => 30,
            CURLOPT_CUSTOMREQUEST => "GET",
            CURLOPT_PROTOCOLS => CURLPROTO_HTTPS
        ]);

        $result = curl_exec($ch);
        // $tasks = json_decode($result, true);
        // for ($i = 0; $i < count($tasks); $i++) {
        // if ($tasks[$i]["task_list_id"] == 55979) {
        //         $tasks_name[$i] = $tasks[$i]["name"];
        //     }
        // }

        print_r(filter_var($result, FILTER_SANITIZE_MAGIC_QUOTES));
        curl_close($ch);
        // return $resultado;
    }

    listTasks();
} catch (Error $e) {
    print_r($e->getMessage());
}
// print_r($_POST['email']));

此返回:

在此处输入图像说明

推荐答案

您可以使用PHP功能之一进行清洁视图:

为了查看任务,您必须查看请求源,因为浏览器正在渲染HTML.如果您对此有任何错误,则可以用于任务主体的功能.

我希望对您有帮助. :)

本文地址:https://www.itbaoku.cn/post/1937814.html

问题描述

I am trying to pull data from API for active collab, but in the body to the task exist tags HTML, causing a mess in the coding, anybody know what I can do?

My code to push API:

    try {
    function listTasks() {  

        $ch = curl_init();
        $token = 'token';
        curl_setopt_array($ch, [
            CURLOPT_URL => 'https://collab.cadastra.com.br/api/v1/projects/projectnumber/tasks/',

            CURLOPT_HTTPHEADER => [
                'X-Angie-AuthApiToken: ' . $token,
                'Content-Type: application/json',
                'x-li-format: json'
            ],
            CURLOPT_RETURNTRANSFER => true,
            CURLOPT_TIMEOUT => 30,
            CURLOPT_CUSTOMREQUEST => "GET",
            CURLOPT_PROTOCOLS => CURLPROTO_HTTPS
        ]);

        $result = curl_exec($ch);
        // $tasks = json_decode($result, true);
        // for ($i = 0; $i < count($tasks); $i++) {
        // if ($tasks[$i]["task_list_id"] == 55979) {
        //         $tasks_name[$i] = $tasks[$i]["name"];
        //     }
        // }

        print_r(filter_var($result, FILTER_SANITIZE_MAGIC_QUOTES));
        curl_close($ch);
        // return $resultado;
    }

    listTasks();
} catch (Error $e) {
    print_r($e->getMessage());
}
// print_r($_POST['email']));

This return:

enter image description here

推荐答案

you can use one of PHP function for clean view:

for view the tasks, otherways you must look at the source of request, cause browser is rendering html. if you will have any errors for this, you can the function use for task body.

I hope it help to you. :)