I have a task.
One input:
input type='text' id='url' name='url'
One button:
button id='go'
and one div.
User writes a site in that input and onclick i must show title of that site
How can i do that ?
I have a task.
One input:
input type='text' id='url' name='url'
One button:
button id='go'
and one div.
User writes a site in that input and onclick i must show title of that site
How can i do that ?
From what you told me, here's some code.
<?php
if (!isset($_GET['go'])) {
?>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="GET" />
<input type="text" name="url" id="url" /><br /><input type="submit" name="go" id="go" />
</form>
<?php
} else {
$url = $_GET['url'];
$file = file($url);
$file = implode("",$file);
if(preg_match("/<title>(.+)<\/title>/i",$file,$m)) {
print "The title of $url is <b>$m[1]";
} else {
print "The page doesn't have a title tag";
}
}
?>
This downloads the file into the PHP memory and gets the information between the title tags.