/    Sign up×
Community /Pin to ProfileBookmark

Hi !

Which command to include so I can see on the screen the result of this ?

thanks !!!!

Patrick

[code=php]<?php
$page_title = “n/a”;
$meta_descr = “n/a”;
$meta_keywd = “n/a”;

if ($handle = @fopen(“http://www.finalwebsites.com”, “r”)) {
$content = “”;
while (!feof($handle)) {
$part = fread($handle, 1024);
$content .= $part;
if (eregi(“</head>”, $part)) break;
}
fclose($handle);
$lines = preg_split(“/r?n|r/”, $content); // turn the content in rows
$is_title = false;
$is_descr = false;
$is_keywd = false;
$close_tag = ($xhtml) ? ” />” : “>”; // new in ver. 1.01
foreach ($lines as $val) {
if (eregi(“<title>(.*)</title>”, $val, $title)) {
$page_title = $title[1];
$is_title = true;
}
if (eregi(“<meta name=”description” content=”(.*)”([[:space:]]?/)?>”, $val, $descr)) {
$meta_descr = $descr[1];
$is_descr = true;
}
if (eregi(“<meta name=”keywords” content=”(.*)”([[:space:]]?/)?>”, $val, $keywd)) {
$meta_keywd = $keywd[1];
$is_keywd = true;
}
if ($is_title && $is_descr && $is_keywd) break;
}
}
?>[/code]

to post a comment
PHP

1 Comments(s)

Copy linkTweet thisAlerts:
@NogDogSep 05.2006 — [code=php]
printf("<p>Title: %s<br>Description: %s<br>Keywords: %s</p>n",
$page_title, $meta_descr, $meta_keywd);
[/code]
×

Success!

Help @patimages spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.28,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...