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 ? Quote 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.. Quote 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"); } ?> Quote 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. Quote Link to comment https://forums.phpfreaks.com/topic/236523-php-redirection-youtube-fault/#findComment-1216025 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.