I've a community site. All members have registered their personal website links in their member profiles on the community site. On a form of the site, they can submit the details of their personal website's page or post. This is done in a field where they fill in the link to their page or post.
I want to validate and verify that the member-submitted link is valid and originates from the member's website as listed in the community site's member profile and is not a third party link. I know this is possible but I don't know how. My programming knowledge is nearly nil.
[This is not necessary but just an idea]>> Is there any way to achieve like what Google does in its "fetch as Google" section of the Search Console, where the first part of the link (http://example.com/) is taken from the website link in the user's profile and cannot be changed, whereas the user can only fill in the later part of the link or only the slug of the page or post in an editable field. The resultant output on a page should be a combined and full link that can be clicked.
Edited and added for clarity:
Required steps:
Step 1 - Validate: Check if the submitted URL is valid.
If valid, go to the next step. Else, return an error.
Step 2 - Verify: Check if the root domain of the submitted link matches the root domain of the existing URL in the member's profile.
If yes, allow submit. Else, return an error.