无法通过 API 参加聚会
unable to rsvp on meetup through API
我正在尝试更新活动的 rsvp 状态,例如 http://www.meetup.com/group/events/219126470/
$event_rsvp_url ="https://api.meetup.com/2/rsvp/?event_id=".$event_id."&key=".$this->meetup_api_key."&rsvp=no";
$curl_handle=curl_init();
curl_setopt($curl_handle, CURLOPT_URL, $event_rsvp_url);
curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 2);
curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl_handle, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($curl_handle, CURLOPT_USERAGENT, 'Your application name');
$query = curl_exec($curl_handle);
curl_close($curl_handle);
return $query;
这就是我得到的全部
string(0) ""
原来我试图得到不是 post。这对我有用。
/**
* Send a POST requst using cURL
* @param string $url to request
* @param array $post values to send
* @return string
*/
function curl_post($url, array $post = NULL){
$cURL = curl_init();
curl_setopt($cURL, CURLOPT_URL, $url);
curl_setopt($cURL, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($cURL, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($cURL, CURLOPT_POST, 1);
curl_setopt($cURL, CURLOPT_POSTFIELDS, $post);
if(!$result = curl_exec($cURL)) {
trigger_error(curl_error($cURL));
}
curl_close($cURL);
return $result;
}
$post = array('event_id' => $event_id, 'key' => $api_key, 'rsvp' => 'yes', 'guests' => '0', 'member_id' => '9736856');
$url = "https://api.meetup.com/2/rsvp/";
print_r($meetup->curl_post($url, $post));
我正在尝试更新活动的 rsvp 状态,例如 http://www.meetup.com/group/events/219126470/
$event_rsvp_url ="https://api.meetup.com/2/rsvp/?event_id=".$event_id."&key=".$this->meetup_api_key."&rsvp=no";
$curl_handle=curl_init();
curl_setopt($curl_handle, CURLOPT_URL, $event_rsvp_url);
curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 2);
curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl_handle, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($curl_handle, CURLOPT_USERAGENT, 'Your application name');
$query = curl_exec($curl_handle);
curl_close($curl_handle);
return $query;
这就是我得到的全部
string(0) ""
原来我试图得到不是 post。这对我有用。
/**
* Send a POST requst using cURL
* @param string $url to request
* @param array $post values to send
* @return string
*/
function curl_post($url, array $post = NULL){
$cURL = curl_init();
curl_setopt($cURL, CURLOPT_URL, $url);
curl_setopt($cURL, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($cURL, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($cURL, CURLOPT_POST, 1);
curl_setopt($cURL, CURLOPT_POSTFIELDS, $post);
if(!$result = curl_exec($cURL)) {
trigger_error(curl_error($cURL));
}
curl_close($cURL);
return $result;
}
$post = array('event_id' => $event_id, 'key' => $api_key, 'rsvp' => 'yes', 'guests' => '0', 'member_id' => '9736856');
$url = "https://api.meetup.com/2/rsvp/";
print_r($meetup->curl_post($url, $post));