fatkatie Posted April 10, 2017 Share Posted April 10, 2017 This site has a textarea used to accept pasted Youtube embed links. Is there a php function or a 3rd party class/module that will validate html 'snippets'? Quote Link to comment https://forums.phpfreaks.com/topic/303677-how-to-validate-html-input-strings/ Share on other sites More sharing options...
Psycho Posted April 10, 2017 Share Posted April 10, 2017 I have no idea by what you mean by "html 'snippets'". Validate what exactly. That it is a properly formatted url, that the URL is a youtube link, that the link actually points to a valid resource, that the url doesn't contain any malicious code, etc., etc. Are you only going to allow youtube links? What should happen to other links? You need to come up with very specific requirements. Quote Link to comment https://forums.phpfreaks.com/topic/303677-how-to-validate-html-input-strings/#findComment-1545282 Share on other sites More sharing options...
Solution requinix Posted April 10, 2017 Solution Share Posted April 10, 2017 The embed snippets all look the same. Just ask the user for the URL to the video, parse_url() it until you reach the video ID, and make the snippet yourself. Quote Link to comment https://forums.phpfreaks.com/topic/303677-how-to-validate-html-input-strings/#findComment-1545285 Share on other sites More sharing options...
fatkatie Posted April 10, 2017 Author Share Posted April 10, 2017 Admin guy... GREAT idea. I couldn't find any validators like this except on-line - with no service interface. Thanks again. Quote Link to comment https://forums.phpfreaks.com/topic/303677-how-to-validate-html-input-strings/#findComment-1545291 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.