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

查看:109
本文介绍了使用标签HTML将数据提取到活动的Collab任务中-PHP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从API进行数据以进行主动协作,但是在任务的正文中存在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?

我要推送API的代码:

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']));

此返回:

推荐答案

您可以使用PHP函数之一进行清晰查看:

you can use one of PHP function for clean view:

  • strip_tags (https://www.php.net/manual/en/function.strip-tags)
  • htmlentities (https://www.php.net/manual/en/function.htmlentities)

要查看任务,否则必须查看请求源,因为浏览器正在呈现html.如果对此有任何错误,可以将该函数用于任务正文.

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. :)

这篇关于使用标签HTML将数据提取到活动的Collab任务中-PHP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆