Skip to content

Instantly share code, notes, and snippets.

@nanasess
Created June 18, 2013 11:12
Show Gist options
  • Save nanasess/5804529 to your computer and use it in GitHub Desktop.
Save nanasess/5804529 to your computer and use it in GitHub Desktop.
Synergy!360 API の PHP サンプル
<?php
$client_id = 'your client id here';
$table_id = 'database1';
$api_key = 'your api id here';
// 登録API
$url = sprintf('https://api.synergy360.jp/%s/api/v1/tables/%s/records', $client_id, $table_id);
$arrParams['api_key'] = $api_key;
$arrParams['record']['short_text8'] = "aaa";
$arrParams['record']['short_text9'] = "bbb";
$postvals = json_encode($arrParams);
$ch = curl_init($url);
$options = array(
CURLOPT_URL => $url,
CURLOPT_POST => 1,
CURLOPT_VERBOSE => 3,
CURLOPT_POSTFIELDS => $postvals,
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_SSLVERSION => 3,
// Content-type: application/json の指定は必須
CURLOPT_HTTPHEADER => array('Content-type: application/json')
);
curl_setopt_array($ch, $options);
$response = curl_exec($ch);
curl_close($ch);
var_dump($response);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment