Warning: Function get_magic_quotes_gpc() is deprecated in /home/forumbs/public_html/includes/class_core.php on line 1960
كود سكربت بسيط استخلاص اللينكات من صفحه [الأرشيف] - منتديات بانى ستار

المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : كود سكربت بسيط استخلاص اللينكات من صفحه



walid_8281500
03-23-2009, 03:40 AM
استخلاص اللينكات من صفحه
هو :



Page Summary
Url: http://www.traidnt.net/
Title: ترايدنت - :: Traidnt.Net ::
Links:
Link: http://www.traidnt.net/Portal/SiteMap.html class=header-navigation-item
Link: http://www.traidnt.net/Portal/Occasions.html class=header-navigation-item
Link: http://www.traidnt.net/Portal/Emailus.html class=header-navigation-item
Link: http://www.traidnt.net/Portal/Honoring-Abosarh-X5.html class=header-navigation-item
Link: http://www.traidnt.net/Portal/Design/index.html class=left-navigation-item strong
Link: http://www.traidnt.net/Portal/Design/Photoshop/index.html class=left-navigation-item
Link: http://www.traidnt.net/Portal/Design/SWiSH/index.html class=left-navigation-item
Link: http://www.traidnt.net/Portal/Design/Flash/index.html class=left-navigation-item
Link: http://www.traidnt.net/Portal/Design/cinema-4d/index.html class=left-navigation-item
Link: http://www.traidnt.net/Portal/Forums/index.html class=left-navigation-item strong
Link: http://www.traidnt.net/Portal/Forums/Design-style/index.html class=left-navigation-item
Link: http://www.traidnt.net/Portal/Forums/Hacks/index.html class=left-navigation-item
Link: http://www.traidnt.net/Portal/Forums/admincp/index.html class=left-navigation-item
Link: http://www.traidnt.net/Portal/Sites/index.html class=left-navigation-item strong
Link: http://www.traidnt.net/Portal/Sites/******s/index.html class=left-navigation-item
Link: http://www.traidnt.net/Portal/Sites/cPanel/index.html class=left-navigation-item
Link: http://www.traidnt.net/Portal/Servers/index.html class=left-navigation-item strong
Link: http://www.traidnt.net/Portal/Servers/Setup/index.html class=left-navigation-item
Link: http://www.traidnt.net/Portal/Servers/Optimize/index.html class=left-navigation-item
Link: http://www.traidnt.net/Portal/Servers/Protect/index.html class=left-navigation-item
Link: http://www.traidnt.net/ss.xml
Link: http://www.traidnt.net/Portal/Design/index.html
Link: http://www.traidnt.net/Portal/Design/rss.xml
Link: http://www.traidnt.net/Portal/Forums/index.html
Link: http://www.traidnt.net/Portal/Forums/rss.xml
Link: http://www.traidnt.net/Portal/Sites/index.html
Link: http://www.traidnt.net/Portal/Sites/rss.xml
Link: http://www.traidnt.net/Portal/Servers/index.html
Link: http://www.traidnt.net/Portal/Servers/rss.xml
Link: http://www.traidnt.net/Portal/Design/cinema-4d/Cinema4D-2.html
Link: http://www.traidnt.net/Portal/SiteMap.html
Link: http://www.traidnt.net/Portal/Occasions.html
Link: http://www.traidnt.net/Portal/Emailus.html
Link: http://www.traidnt.net/Portal/Honoring-Abosarh-X5.html
End
Press the back button to try again.


الكود البرمجى هو :



<?php
// findlinks.php
// php code example: find links in an html page
// mallsop.com 2006 gpl
echo "<HTML><HEAD><TITLE>findlinks.php</TITLE></HEAD> \n";
echo "<BODY bgcolor=\"#336699\" ****=\"000000\" link=\"#416D96\" vlink=\"#414141\" alink=\"#DDCEA2\"> \n";
echo "<form method=post action=\"$PHP_SELF\"> \n";
echo "<p><table align=\"absmiddle\" width=\"100%\" bgcolor=\"#ededed\" name=\"tablesiteopen\" border=\"0\">\n";
echo "<tr><td align=left>";
if ($_POST["FindLinks"]) {
$urlname = trim($_POST["urlname"]);
if ($urlname == "") {
echo "Please enter a urlname. <br>\n";
}
else { // open the html page and parse it

$page_title = "n/a";
$links[0] = "n/a";
//$meta_descr = "n/a";
//$meta_keywd = "n/a";

if ($handle = @fopen($urlname, "r")) { // must be able to read it
$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 into rows

// boolean
$is_title = false;
//$is_descr = false;
//$is_keywd = false;
$is_href = false;
$index = 0;

//$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("<a href=(.*)</a>", $val, $alink)) {

$newurl = $alink[1];
$newurl = eregi_replace(' target="_blank"', "", $newurl);
$newurl = trim($newurl);
$pos1 = strpos($newurl, "/>");
if ($pos1 !== false) {
$newurl = substr($newurl, 1, $pos1);
}
$pos2 = strpos($newurl, ">");
if ($pos2 !== false) {
$newurl = substr($newurl, 1, $pos2);
}
$newurl = eregi_replace("\"", "", $newurl);
$newurl = eregi_replace(">", "", $newurl);

//if (!eregi("http", $newurl)) { // local
// $newurl = "http://".$_SERVER["HTTP_HOST"]."/".$newurl;
// }
if (!eregi("http", $newurl)) { // local
$pos1 = strpos($newurl, "/");
if ($pos1 == 0) {
$newurl = substr($newurl, 1);
}
$newurl = $urlname.$newurl;
}

// put in array of found links
$links[$index] = $newurl;
$index++;
$is_href = true;

}

} // foreach lines done

echo "<p><b>Page Summary</b><br>\n";
echo "<b>Url:</b> ".$urlname."<br>\n";
if ($is_title) {
echo "<b>Title:</b> ".$page_title."<br>\n";
}
else {
echo "No title found<br>\n";
}
echo "<b>Links:</b><br>\n";
if ($is_href) {
foreach ($links as $myval) {
echo "Link: ".$myval."<br>\n";
}
}
else {
echo "No links found<br>\n";
}
echo "End</p>\n";
} // fopen handle ok
else {
echo "<br>The url $urlname does not exist or there was an fopen error.<br>";
}
echo "Press the back button to try again.<br>";
} // end else urlname given
} // else find links now submit
else {
$urlname = "http://www.google.com/intl/en/about.html"; // or whatever page you like
echo "<p><b>findlinks.php example</b><br>\n";
echo "File or URL: <input type=\"****\" name=\"urlname\" value=\"$urlname\" maxlength=\"255\" size=\"80\"><br>\n";
echo "<input type=\"SUBMIT\" name=\"FindLinks\" value=\"Find\"></font><br></p> \n";
}
echo "</td></tr>";
echo "</table></p>";
echo "</form></BODY></HTML>\n";

?>