Get data from app kintone via API

Dear All

i am new user of kintone, no i have app ABCD with field (field_A, サービス内容, 一般料金(ルピア)【一覧】)

now i want to display record of that filed on php file.

would you like to helpme, below is my code



$query =$_POST[‘query’];
$subdomain = “abcd”; // subdomain
$token = “BNcxdSfZFa97779u29hW6qC8888”;
$appId = “18”; // App ID of product app


$subdomain = “abcd”; // subdomain
// Set HTTP header to send to server
$options = array (
‘http’ => array (
‘method’ => ‘GET’,
‘header’ => “X-Cybozu-API-Token:”. $token. "\r "
$buildQuery = http_build_query (array (“app” => $appId, “query” => $query), “”, “&”);
// create context
$context = stream_context_create ($options);
// Connect to server and get data
//$contents = file_get_contents (‘https: //’.$subdomain.’’.$buildQuery, FALSE, $context);
$contents = file_get_contents( ‘https://’.$subdomain.’’.htmlspecialchars_decode($buildQuery), FALSE, $context );

$data = json_decode ($contents, true);
echo json_encode ($data [“records”]);
echo $data;

RS - Indonesian


Hello Rika,

I am not too familiar with PHP but once I proceeded as is, the 1st parameter of file_get_contents URLs query part became null.

My guess is that the URL is not set up correctly and also, I was not sure what type of errors were coming up.

By executing the process below, you can obtain the value of the record.

define(“API_TOKEN”, “*****”);

define(“SUB_DOMAIN”, “****”);

define(“APP_NO”, “100”);

define(“QUERY”, “limit 1”);

//set up an HTTP header transmitting a server

$options = array(



‘header’=> “X-Cybozu-API-Token:”. API_TOKEN ."\r"



//generate the context

$context = stream_context_create( $options );

//connected to the server receive data

$contents = file_get_contents( ‘https://’. SUB_DOMAIN .’’. APP_NO .’&query=’. urlencode(QUERY), FALSE, $context );

echo $contents;

You can also process the PHP from the page below:

Please tell us know what type of errors you are getting and where it is happening so we can assist you further.