Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8207255
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T08:56:21+00:00 2026-06-07T08:56:21+00:00

Okay, here’s a fun one. I need to figure out what source a user

  • 0

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!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T08:56:23+00:00Added an answer on June 7, 2026 at 8:56 am

    You don’t need regular expressions:

    function discoverVimeo($url)
    {
        if ((($url = parse_url($url)) !== false) && (preg_match('~vimeo[.]com$~', $url['host']) > 0))
        {
            $url = array_filter(explode('/', $url['path']), 'strlen');
    
            if (in_array($url[0], array('album', 'channels', 'groups')) !== true)
            {
                array_unshift($url, 'users');
            }
    
            return array('type' => rtrim(array_shift($url), 's'), 'id' => array_shift($url));
        }
    
        return false;
    }
    

    The following will return an array, with an index id and another index type, that will be one of:

    • user
    • album
    • channel
    • group
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Okay, here is the deal: User's can buy 'gold' inside of the app with
Okay, so here is what I'm trying to do. The user inputs a number.
Okay so here's my issue. The user can go onto my site and retrieve
Okay so here's the scenario: User is presented with form that contains file inputs.
Okay, two admissions here, one is I'm sure this question has been answered and
Okay here's my situation. I have the following branches development development-kirby (270 commits ahead
Okay here is what I'm trying to do: I have a model object that
Okay so here's, the scenario I have a thumbnail that contains an artists profile
Okay so here is what I want to do. I want to add a
Okay so here's what I'm doing. I'm making a request to a server to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.