Discussions

Ask a Question
Back to All

PHP example for deleting a branded link

Can anyone provide an example of how to delete a link with PHP? I see the creation example, but was a little confused on how to delete a link with PHP: <?php
[...]
$domain_data["fullName"] = "rebrand.ly";
$post_data["destination"] = "https://www.youtube.com/channel/UCHK4HD0ltu1-I212icLPt3g";
$post_data["domain"] = $domain_data;
//$post_data["slashtag"] = "A_NEW_SLASHTAG";
//$post_data["title"] = "Rebrandly YouTube channel";
$ch = curl_init("https://api.rebrandly.com/v1/links");
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
"apikey: YOUR_API_KEY",
"Content-Type: application/json",
"workspace: YOUR_WORKSPACE_ID"
));
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($post_data));
$result = curl_exec($ch);
curl_close($ch);
$response = json_decode($result, true);
print "Short URL is: " . $response["shortUrl"];
?>