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 8952359
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T13:51:24+00:00 2026-06-15T13:51:24+00:00

I would like for users to be able to enter their company website URL

  • 0

I would like for users to be able to enter their company website URL in their company setup dialog, but I need to validate that. Apart from the typical sanitization functions, I would like to check if the URL scheme is http:// or https:// without the assumption the user has already entered it.

My function already parses the entered url to detect the scheme with a regex, but I would like to (ideally) check the URL from the server ala file_get_contents or parse_url and get the scheme, but I don’t know how could I do it.

  • 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-15T13:51:25+00:00Added an answer on June 15, 2026 at 1:51 pm

    Take a look at parse_url(). The scheme will be returned in the scheme element of the array.

    Edit 1

    Partial URLs are also accepted, parse_url() tries its best to parse them correctly.

    If the scheme is not present in the URL, then the scheme element will be missing.

    Edit 2

    As @BenediktOlek says, you can use cURL to query the server:

    $curl = curl_init();
    curl_setopt_array(
        $curl,
        array(
            CURLOPT_URL            => 'http://www.example.com/',
            CURLOPT_HEADER         => TRUE,  // Output the response headers
            CURLOPT_RETURNTRANSFER => TRUE,  // Return output as a string
            CURLOPT_NOBODY         => TRUE   // Use request method "HEAD"
        )
    );
    $curlData = curl_exec($curl);
    curl_close($curl);
    

    If the server requires an HTTPS connection, and is correctly configured, then it should return a Location: header with an HTTPS URL.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to track users clicks on my website. For that purpose, I
I'm using CKEditor and would like to be able to allow users to upload
We have a project (Web/PHP) where we would like users to access their files,
I would like to store the search queries the users enter on my site.
I would like to pursue making a website widget that can allow visitors to
I would like to be able to get the navigation history from my users
I have a string that users are able to enter on the internet, currently
I would like to create a TextBox that allows users to key in decimal
I'm building an Android App where users need to be able to edit their
I would like to have a aspect of my site that users can use

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.