get($hubTopic); if ($sub === false) { //we do not know this subscription header('HTTP/1.0 404 Not Found'); echo "We are not subscribed to this hub.topic\n"; exit(1); } $pos = array_search($hubTopic, $GLOBALS['phinde']['subscriptions']); if ($pos !== false) { //we do not want to unsubscribe header('HTTP/1.0 404 Not Found'); echo "We do not want to unsubscribe from this hub.topic\n"; exit(1); } $sub->remove($hubTopic); header('HTTP/1.0 200 OK'); header('Content-type: text/plain'); echo "Unsubscribed.\n"; exit(0); } else { header('HTTP/1.0 400 Bad Request'); echo "Invalid parameter value for hub.mode\n"; exit(1); } function isValidUrl($url) { if (filter_var($url, FILTER_VALIDATE_URL) === false) { return false; } if (substr($url, 0, 7) == 'http://' || substr($url, 0, 8) == 'https://' ) { return true; } return false; } ?>