Okay, here's a fun one.
I need to figure out what source a user is referencing when entering a copy and pasted Vimeo URL into an input box. For those that are unfamiliar, Vimeo currently has 4 different sources that are accessible through their simple API:
Videos belonging to a user
Valid URL structure: http://vimeo.com/user3825208 or https://vimeo.com/davekiss
Videos belonging to a group
Valid URL structure: http://vimeo.com/groups/eos550d or https://vimeo.com/groups/162
Videos belonging to a channel
Valid URL structure: http://vimeo.com/channels/hd or https://vimeo.com/channels/201
Videos belonging to an album
Valid URL structure: http://vimeo.com/album/1919683 or https://vimeo.com/album/mycustomname
So basically, I want to be able to run the URL into a function which will tell me what source the URL belongs to.
I've been using this for videos belonging to a user, but now I need to expand to all sources.
sscanf(parse_url($url, PHP_URL_PATH), '/%d', $video_id);
Maybe I should do this four times? preg_match('???', $url);
Thanks for your help!