0
Gravity Forms 웹 API를 사용하여 항목을 업데이트하려고합니다. 현재이 PHP 코드입니다.Gravity Forms 웹 API 업데이트 항목
<?php
$api_key = '';
$private_key = '';
$method = 'PUT';
$endpoint = 'https://www.website.co.uk/gravityformsapi/';
//$route = 'entries';
$route = 'entries/61';
$expires = strtotime('+60 mins');
$string_to_sign = sprintf('%s:%s:%s:%s', $api_key, $method, $route, $expires);
$sig = calculate_signature($string_to_sign, $private_key);
$api_call = $endpoint.$route.'?api_key='.$api_key.'&signature='.$sig.'&expires='.$expires;
//array of entries (each entry is an array with key=field id)
$entries = array(
array("status"=>"active","1.3"=>$_POST['first_name'],)
);
$ch = curl_init($api_call);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($entries));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, 1);
$result = curl_exec($ch);
function calculate_signature($string, $private_key) {
$hash = hash_hmac("sha1", $string, $private_key, true);
$sig = rawurlencode(base64_encode($hash));
return $sig;
};
?>
내가받는 응답은 게시물이 업데이트되었지만 게시물을 업데이트하는 대신 게시물을 삭제하는 것 같습니다. 누구든지 내 코드에 문제가있는 것을 볼 수 있습니까? Wordpress에서 편집 한 항목의 페이지를 새로 고치면이 오류가 발생합니다.
Fatal error: Cannot use object of type WP_Error as array in /data02/c6536622/public_html/wp-content/plugins/gravityforms/entry_detail.php on line 57
잘못 가고 중력 양식을 사용하거나 워드 프레스 있는지 알아 로그를 얻을 수 어쨌든 있나요?