$args = array(
'name' => 'test',
'description' => 'xxxx',
'start_time' => 'xxxx',
'end_time' => 'xxxxx'
);
$target_url = "https://graph.facebook.com/me/events";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $target_url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $args);
$result = curl_exec($ch);
curl_close($ch);
Returns
{"id":"xxxx"}
I Want this id as $id in php So i can use It further too..
thanks.
You would use
json_decodefor this, check out this example:You can always just use $Object->id in place of resetting it to the $id variable, but it doesnt matter.
json_decode()documentation: https://www.php.net/json_decode