smithmr8 Posted May 16, 2011 Share Posted May 16, 2011 Hi, Have a project, http://ziz.im URL Shortener. For some reason, shortened youtube links don't work. When used, they go to the youtube page, displaying a message saying the video is not available. But it's the same link (once redirected) as the original link. Any idea what could be causing this ? Link to comment https://forums.phpfreaks.com/topic/236523-php-redirection-youtube-fault/ Share on other sites More sharing options...
smithmr8 Posted May 16, 2011 Author Share Posted May 16, 2011 Apologies. I was formatting the URL to lower case, which conflicted with the variance in youtube identifiers. Pfft. Is there any good scripts for verifying a URL is valid ? Checks if has http, www, ect.. Link to comment https://forums.phpfreaks.com/topic/236523-php-redirection-youtube-fault/#findComment-1215936 Share on other sites More sharing options...
matthew9090 Posted May 16, 2011 Share Posted May 16, 2011 if you want to check if the url is valid then do something like this: <?php $url = $_SERVER['HTTP_HOST']; //get domain name of the url submitted if (stristr($url, "http://")) { //now do the same for www or co.uk, .com etc...... } else { die("url is not valid"); } ?> Link to comment https://forums.phpfreaks.com/topic/236523-php-redirection-youtube-fault/#findComment-1216016 Share on other sites More sharing options...
JasonLewis Posted May 16, 2011 Share Posted May 16, 2011 Additionally you can use parse_url. Read that manual entry carefully, as it states it does not validate the URL, it merely breaks it down into the components. Link to comment https://forums.phpfreaks.com/topic/236523-php-redirection-youtube-fault/#findComment-1216025 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.