Tuesday, 15 January 2013

how to get meta tags with php, but with html form -


get_meta_tags ('http://www.autostraddle.com'); The echo is "CMS:"; Echoes $ tag ['generator'];

This code is not user-friendly; This is not ready for an online tool for my website, because I want to create a simple service - CMS detector and ...

  $ tag = isset ($ _ requests ['url '])? Get_meta_tags ('url'): ''; & Lt; Form action = "index.php" method = "post" & gt; & Lt; Input type = "text" name = "url" size = "65" value = "& lt ;? php echo $ tag ;? gt ;? /> & Lt; Br / & gt; & Lt; Input type = "submit" value = "go!" & Gt; Echo $ tag ['generator'];  

I want to create an online tool to find out if I have a CMS, but I need this PHP script with HTML form because it will be used by users, and not Only me

have to keep any URL, and then will act as the script described for getting the Meta tag 'generator'; How do I get the meta tag 'generator'? I only want this meta tag.

OK, and how to do this with 'if else'? If the Meta Tags Generator does this, but such a tag is not 'Generator', then type any 'echo' message, such as

CMS is not known.

Well, this is a simple PHP script, but I do not know how to create variables and get the URL; What is the merit with the CRL?

What you are struggling with is actually getting user-side input from POST superglobals . It's something you can try, but there are several ways to implement it. You can use method = "SET" and capture user parameters from the URL of the action = "" file.

Notice, in this case, the verb = "" parameter is empty, that means PHP script will execute on the same page where the HTML form is. It may be that you do not try to do this, so if you need to redirect, add the PHP code to a different file and put it on your website and in the action = "" parameter Add. / P>

  & lt; Form action = "" method = "post" & gt; & Lt; Input type = "text" name = "url" size = "65" placeholder = "http: // yoururl" /> & Lt; Input type = "submit" name = "submit" value = "go!" & Gt; & Lt; / Form & gt; & Lt ;? Php if (isset ($ _ POST ['submit']) {$ tag = get_meta_tags ($ _ POST ['url']); If ($ tag ['generator']) "CMS: & lt; b & gt; $ tag ['generator']" & lt; / P & gt; & Lt; Br> "Else resonance" no CMS information is available. & Lt; Br>  

Give it a shot.


No comments:

Post a Comment