#1
|
||||
|
||||
![]()
بسم الله الرحمن الرحيم
السلام عليكم ورحمة الله وبركاته الحمد لله رب العالمين والصلاة والسلام على سيدنا محمد خاتم الانبياء والمرسلين اما بعد : كيفكم استاذتي الكرام في ترايدنت ان شاء الله تكونوا في اتم الصحة :) الحمد لله قمت بتجربة برمجة عنبكوت بحث لجلب عناوين والراوبط ومحتويات الموقع كجوجل ولكنه طبعا بسيط وقيد التطوير المهم نجحت في تطبيق خوارزميات بسيطة طبعا باستعمال دوال cUrl كوسيط للاتصال بالسيرفر وجلب المعلومات والكود حاليا تجريببي لا ااكثر وهو كما قلت سابقا قيد التطوير :) من مميزات العنكب : 1 - سهولة الاستعمال 2 - مفتوح المصدر 3 - جلب جميع الروابط 4 - جلب Meta Name Tag والتي تستعملها اغلب العناكب 5 - جلب عنوان الموقع 6 - جلب معلومات السيرفر 7 - امكانية تسميته من عيوب العنكب : 1 - بطيئ قليلا 2 - قيد التجربة وهذا الكود : رمز PHP: spider_name = ($spider_name); } if (!empty($storage_website_folder) && isset($storage_website_folder)) { $this->storage_website_folder = ($storage_website_folder); if (!file_exists($this->storage_website_folder)) { mkdir($storage_website_folder , "0655"); } } if (!empty($storage_file) && isset($storage_file)) { $this->storage_file = ($storage_file); } return ($this->spider_name); return ($this->storage_website_folder); return ($this->storage_file); } # construct method close public function connectServer ($url,$header=false) { if (!empty($url) && isset($url)) { // intialize curl library $init = curl_init(); if (isset($init)) { $this->curl_intialize = $init; } if (filter_var($url,FILTER_VALIDATE_URL)) { // set curl option url to connect curl_setopt($this->curl_intialize, CURLOPT_URL , $url); // set return transfer true to return the data curl_setopt($this->curl_intialize, CURLOPT_RETURNTRANSFER, true); // get site header if (is_bool($header) || is_int($header)) { if ($header == true) { curl_setopt($this->curl_intialize, CURLOPT_HEADER , true); } else { curl_setopt($this->curl_intialize, CURLOPT_HEADER , false); } } else { die ("Q8mb Bot:the header prameter you must be boolean or integar type"); } // change spider name curl_setopt($this->curl_intialize, CURLOPT_USERAGENT , $this->spider_name); // TIME OUT CONNECTION curl_setopt($this->curl_intialize , CURLOPT_CONNECTTIMEOUT , 0); $output = curl_exec($this->curl_intialize); $info = curl_getinfo($this->curl_intialize); if (is_array($info) && isset($info)) { $this->site_info = $info; } $connectionStatus = $this->connectionStatus(); if ($connectionStatus == true) { if (isset($output)) { $this->site_output = $output; $this->storageDataIntoFile($this->storage_file); } } else { $website_dir = ($this->storage_website_folder."/".$this->storage_file); if (file_exists($website_dir) && isset($website_dir)) { unlink($website_dir); } die ("Q8mb Bot:connection error Refresh "); } } else { die ("Q8mb Bot:this url not valid !!"); } } else { die or exit ("Q8mb Bot:please insert url !!!"); } } # connect server method close public function connectionStatus () { $website_info = $this->getInfo(); if (is_array($website_info) && isset($website_info)) { $http_code = $website_info['http_code']; if ($http_code>=200 && $http_codestorage_website_folder); $storage_src = str_ireplace("\/","",$this->storage_website_folder); $storage_src = ($this->storage_website_folder."/".$file_name); if (isset($storage_src) && !empty($storage_src)) { $open_file = fopen("".$storage_src."","w"); fwrite($open_file,$this->getContent()); if (isset($open_file)) { fclose($open_file); } } } else { die or exit ("Q8mb Bot:please insert file name !!!"); } } # storage data into file method close public function getTitle () { $storage_file = ($this->storage_website_folder."/".$this->storage_file); if (isset($storage_file) && file_exists($storage_file)) { $content=file_get_contents($storage_file); if (isset($content) && !empty($content)) { $title = explode("", $content); $title = explode("", $title[1]); if (is_array($title)) { return ($title[0]); } } } } # get title method close public function getUrl ($type="href") { $storage_file = ($this->storage_website_folder."/".$this->storage_file); if (isset($storage_file) && file_exists($storage_file)) { $content=file_get_contents($storage_file); if (isset($content) && !empty($content)) { $url_href = []; $url_desc = []; $url_all = []; preg_match_all("/\ array_push($url_desc, $matches[2]); array_push($url_all, $matches[0]); if ($type==("href")) { return ($url_href); } else if ($type=="desc") { return ($url_desc); } else if ($type=="all") { return ($url_all); } } } } } } # get url method close public function getMetaName ($name) { $storage_file = ($this->storage_website_folder."/".$this->storage_file); if (isset($storage_file) && file_exists($storage_file)) { $content=file_get_contents($storage_file); if (isset($content) && !empty($content)) { if (isset($name) && !empty($name)) { if ($name==("description")) { preg_match_all("/\/iU" , $content, $meta_name , PREG_SET_ORDER); } else if ($name==("author")) { preg_match_all("/\/iU" , $content, $meta_name , PREG_SET_ORDER); } else if ($name==("generator")) { preg_match_all("/\/iU" , $content, $meta_name , PREG_SET_ORDER); } else if ($name==("keywords")) { preg_match_all("/\/iU" , $content, $meta_name , PREG_SET_ORDER); } else if ($name==("application-name")) { preg_match_all("/\/iU" , $content, $meta_name , PREG_SET_ORDER); } else { die ("Q8mb Bot:this meta name value not found in html"); } if ( is_array($meta_name) && isset($meta_name) && !empty($meta_name) ) { $count_meta_name = ( count($meta_name) - 1 ); for ($i=0; $isite_output) && !empty($this->site_output)) { return ($this->site_output); } else { return ("Q8mb Bot:Access Denied !!"); } } # get content method close public function getInfo () { if (isset($this->site_info) && !empty($this->site_info)) { if (is_array($this->site_info)) { return ($this->site_info); } } else { return ("Q8mb Bot:Access Denied !!"); } } # get info method close public function extractArray ($array) { if (is_array($array) && isset($array)) { echo (""); print_r ($array); echo (""); } else { die ("Q8mb Bot:the pramrter you must be array"); } } # extract array method close public function __destruct() { if (isset($this->curl_intialize)) { curl_close($this->curl_intialize); } } # destruct method close } } else { die ("The class spider already exists"); } ?> طريقة الاستعمال : <div style="margin:20px; margin-top:5px"> رمز PHP: <div class="alt2"> <div dir="ltr" style="text-align:left;"> <span style="color: #000000"> $spider = new spider("-- Q8mb Bot --","store","robot.txt"); $spider->connectServer("http://localhost/mysite/",false); // $spider->extractArray($spider->getUrl()); preview array echo ("وصف الموقع : "); $meta_name = $spider->getMetaName("description"); $meta_name_description = $meta_name["data"]; echo ($meta_name_description." "); echo ("مالك الموقع : "); $meta_name = $spider->getMetaName("author"); $meta_name_author = $meta_name["data"]; echo ($meta_name_author." "); echo ("الكلمات المفتاحية : "); $meta_name = $spider->getMetaName("keywords"); $meta_name_keywords = $meta_name["data"]; echo ($meta_name_keywords." "); $title = $spider->getTitle(); echo ("عنوان الموقع : "); if (isset($title)) { echo ($title." "); } $urls = $spider->getUrl(); echo (" روابط الموقع الفرعية: "); for ($i=0;$igetUrl("desc"); echo (" الكلمات الدلالية: "); for ($i=0;$i<span style="color: #007700"> |
مواقع النشر (المفضلة) |
|
|
![]() |
||||
الموضوع | كاتب الموضوع | المنتدى | مشاركات | آخر مشاركة |
[ تجربتي ] تجربتي مع شركة بروبكس (الربح عن طريق مشاهدة الاعلانات) | RSS | Arabic Rss | 0 | 01-23-2014 07:27 PM |
[ تجربتي ] تعرضت للنصب من ايجى تكنولوجى واعرض تجربتي حتي لا يتم النصب علي الاخرين هنا | RSS | Arabic Rss | 0 | 10-28-2013 02:31 AM |
[ تجربتي ] (تجربتي + شرح) في الشراء من موقع Play.com | RSS | Arabic Rss | 0 | 12-05-2011 02:12 AM |
[ تجربتي ] تجربتي في الشراء من موقع Cellpig.com المتخصص في إكسسوارات الجوالات | RSS | Arabic Rss | 0 | 06-26-2011 11:23 PM |
[ طلب برمجه ] : مطلوب برمجة جاهزة أو برمجة موقع رياضي كامل . | RSS | Arabic Rss | 0 | 06-21-2011 10:14 AM |
|