api - Check if YouTube User Exists with PHP -


okay i'm trying redirect user subto.me.com if subto.me/args doesn't exist have code

if(file_exists($basepath."partials/".$request['args'][0].".php")) {             require($basepath."partials/".$request['args'][0].".php");         } else {             header("location: http://www.youtube.com/subscription_center?add_user=".$request['args'][0]);         } 

if youtube user doesn't exist, using link https://gdata.youtube.com/feeds/api/users/fdsafsdfasdfasd. how incooperate if source code equals "user not found"

i have solution that:

$yuser = "http://www.youtube.com/user/xxxx"; $yt_headers = @get_headers($yuser); if($yt_headers[0] == 'http/1.1 404 not found') { echo "youtube user dosen't exist"; } else { echo "youtube user exists"; } 

this can used function make process more pretty!


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -