私はvtigerに接続するコードを持っていますが、今はvtigerモジュールのアカウントにデータを挿入するのに問題があります。私は問題はありません選択したステートメントで、それは正常に動作していますが、私はデータを挿入することはできません。新しい組織を作りたいvtigerテーブルへの挿入、
function call($url, $params, $type = "GET")
{
$is_post = 0;
if($type == "POST") {
$is_post = 1;
$post_data = $params;
} else {
$url = $url . "?" . http_build_query($params);
}
$ch = curl_init($url);
if(!$ch) {
die("Cannot allocate a new PHP-CURL handle");
}
if($is_post) {
curl_setopt($ch, CURLOPT_POST, $is_post);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($params));
}
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$data = curl_exec($ch);
$return = null;
if(curl_error($ch)) {
$return = false;
} else {
$return = json_decode($data, true);
}
curl_close($ch);
return $return;
}
$endpointUrl = 'http://localhost/vtigercrm/webservice.php';
$userName = 'username';
$password = 'pass';
$userAccessKey = 'acckey';
$sessionData = call($endpointUrl, array(
"operation" => "getchallenge",
"username" => $userName
));
$challengeToken = $sessionData['result']['token'];
$generatedKey = md5($challengeToken . $userAccessKey);
$dataDetails = call($endpointUrl, array(
"operation" => "login",
"username" => $userName,
"accessKey" => $generatedKey
), "POST");
$query = "INSERT INTO Accounts(accountname) VALUES ('some_name');";
$sessionid = $dataDetails['result']['sessionName'];
$getUserDetail = call($endpointUrl, array(
"operation" => "query",
"sessionName" => $sessionid,
'query' => $query
));
ようこそスタックオーバーフローに!デバッグのヘルプ(**はなぜこのコードが動作しないのですか?**)には、目的の動作、特定の問題またはエラー、およびそれを再現するのに必要な最短コード**を質問に含める必要があります**。 **明確な問題文**のない質問は、他の読者には役に立たない。参照:[最小限で完全で検証可能なサンプルの作成方法](http://stackoverflow.com/help/mcve) – GrumpyCrouton