当前位置 : 主页 > 网络编程 > PHP >

tips-1048079-05.php

来源:互联网 收集:自由互联 发布时间:2021-06-28
tips-1048079-05.php kintone.php _subDomain . ".cybozu.com:443", "X-Cybozu-API-Token: " . $this-_apiToken ); $queryStr = 'company like "'. $keyword. '"'; $params = "?app=$this-_appIdquery=".urlencode($queryStr) . "fields[0]=". urlencode("com
tips-1048079-05.php
kintone.php


 _subDomain . ".cybozu.com:443",
            "X-Cybozu-API-Token: " . $this->_apiToken
        );

        $queryStr = 'company like "'. $keyword. '"';
        $params = "?app=$this->_appId&query=".urlencode($queryStr)
                    . "&fields[0]=". urlencode("company")
                    . "&fields[1]=". urlencode("representative")
                    . "&fields[2]=". urlencode("area")
                    . "&fields[3]=". urlencode("address")
                    . "&fields[4]=". urlencode("tel");

        $url = "https://" . $this->_subDomain . ".cybozu.com/k/v1/records.json". $params;

        $response = $this->_request($url, true, "get", null, $header);
        $result = json_decode($response, true);

        if (count($result["records"]) > 0) {
            foreach($result["records"] as $value) {
                if ($contentStr != '') {
                    $contentStr .= "\n\n";
                }
                $contentStr .= "公司名:".     $value["company"]["value"]."\n"
                               . "公司代表:". $value["representative"]["value"]."\n"
                               . "地域:".     $value["area"]["value"]."\n"
                               . "所在地:".   $value["address"]["value"]."\n"
                               . "电话:".     $value["tel"]["value"];
            }
        }
        else {
            $contentStr = "未找到该企业信息";
        }

        return $contentStr;
    }

    private function _request($curl, $https = true, $post = "get", $data = null, $header = null, $type = null)
    {
        $Curl = new Curl();
        return $Curl->_request($curl, $https, $post, $data, $header, $type);
    }
}
?>
上一篇:tips-1048079-06.php
下一篇:tips-1048079-04.php
网友评论