Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; WP_MatchesMapRegex has a deprecated constructor in /var/www/phpcoban.com/public_html/wp-includes/class-wp.php on line 632

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Translation_Entry has a deprecated constructor in /var/www/phpcoban.com/public_html/wp-includes/pomo/entry.php on line 14

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; POMO_Reader has a deprecated constructor in /var/www/phpcoban.com/public_html/wp-includes/pomo/streams.php on line 12

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; POMO_FileReader has a deprecated constructor in /var/www/phpcoban.com/public_html/wp-includes/pomo/streams.php on line 120

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; POMO_StringReader has a deprecated constructor in /var/www/phpcoban.com/public_html/wp-includes/pomo/streams.php on line 175

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; POMO_CachedFileReader has a deprecated constructor in /var/www/phpcoban.com/public_html/wp-includes/pomo/streams.php on line 221

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; POMO_CachedIntFileReader has a deprecated constructor in /var/www/phpcoban.com/public_html/wp-includes/pomo/streams.php on line 236

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; WP_Widget_Factory has a deprecated constructor in /var/www/phpcoban.com/public_html/wp-includes/widgets.php on line 544

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; EzAdSense has a deprecated constructor in /var/www/phpcoban.com/public_html/wp-content/plugins/easy-adsense-lite/easy-adsense-lite.php on line 38

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; EzAdsWidget has a deprecated constructor in /var/www/phpcoban.com/public_html/wp-content/plugins/easy-adsense-lite/easy-adsense-lite.php on line 941

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; EzAdsSearch has a deprecated constructor in /var/www/phpcoban.com/public_html/wp-content/plugins/easy-adsense-lite/easy-adsense-lite.php on line 1003

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; EzAdsLU has a deprecated constructor in /var/www/phpcoban.com/public_html/wp-content/plugins/easy-adsense-lite/easy-adsense-lite.php on line 1078

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; EzBaseOption has a deprecated constructor in /var/www/phpcoban.com/public_html/wp-content/plugins/easy-adsense-lite/EzOptions.php on line 22

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; EzCheckBox has a deprecated constructor in /var/www/phpcoban.com/public_html/wp-content/plugins/easy-adsense-lite/EzOptions.php on line 174

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; EzRadioBox has a deprecated constructor in /var/www/phpcoban.com/public_html/wp-content/plugins/easy-adsense-lite/EzOptions.php on line 199

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; EzSelect has a deprecated constructor in /var/www/phpcoban.com/public_html/wp-content/plugins/easy-adsense-lite/EzOptions.php on line 250

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; EzMessage has a deprecated constructor in /var/www/phpcoban.com/public_html/wp-content/plugins/easy-adsense-lite/EzOptions.php on line 294

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; EzHelpTag has a deprecated constructor in /var/www/phpcoban.com/public_html/wp-content/plugins/easy-adsense-lite/EzOptions.php on line 313

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; EzHelpPopUp has a deprecated constructor in /var/www/phpcoban.com/public_html/wp-content/plugins/easy-adsense-lite/EzOptions.php on line 328

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; EzTextArea has a deprecated constructor in /var/www/phpcoban.com/public_html/wp-content/plugins/easy-adsense-lite/EzOptions.php on line 346

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; EzText has a deprecated constructor in /var/www/phpcoban.com/public_html/wp-content/plugins/easy-adsense-lite/EzOptions.php on line 366

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; EzSubmit has a deprecated constructor in /var/www/phpcoban.com/public_html/wp-content/plugins/easy-adsense-lite/EzOptions.php on line 385

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; EzColorPicker has a deprecated constructor in /var/www/phpcoban.com/public_html/wp-content/plugins/easy-adsense-lite/EzOptions.php on line 409

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; EzOneTab has a deprecated constructor in /var/www/phpcoban.com/public_html/wp-content/plugins/easy-adsense-lite/EzOptions.php on line 432

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; EzMiniTab has a deprecated constructor in /var/www/phpcoban.com/public_html/wp-content/plugins/easy-adsense-lite/EzOptions.php on line 476
Crawl site và lấy số điện thoại trên site

Crawl site và lấy số điện thoại trên site

1.Crawl site

Đầu tiên mình sẽ hướng dẫn các bạn crawler một website :

Ở bài hướng dẫn này mình sẽ sử dụng thư viện rất hữu ích của php đó là thư viện PHPCrawl.

-Các bạn vào link : ‘phpcrawl.cuab.de’  để tải thư viện PHPCrawl về.

-Giải nén file zip ra.

-Coppy nó vào htdocs (ở đây mình dùng xampp).

-Để crawl site các bạn vào file example.php sửa cho mình như sau :

 

sửa function handleDocumentInfo($DocInfo)

sửa function handleDocumentInfo($DocInfo)

Các bạn xóa hết phần echo trong hàm “function handleDocumentInfo($DocInfo)”  và thay bằng “print_r($DocInfo);” .

Tiếp theo :

2

-Ở phần :  $crawler->setURL(“http://phpcoban.com/”);  các bạn có thể thay site http://phpcoban.com/ bằng site mà các bạn muốn crawler

-Để có thể định dạng được nhiều ảnh hơn. Thay “$crawler->addURLFilterRule();” bằng :

– Các bạn thêm đoạn code này vào  :

– cuối cùng các bạn thêm “print_r($report);” để in $report ra .

Và sau đó bật xampp lên vào localhost, chạy file “example.php” để test kết quả nhé. Good Luck ^^.

2.Crawler số điện thoại trên site.

Bây giờ mình sẽ hướng dẫn cách chỉ lấy số điện thoại trên website mình muốn.

Tương tự các bạn tải thư viện phpcrawl về máy rồi giải nén ra giúp mình (link download: ‘phpcrawl.cuab.de’  )

Các bạn cần thêm file “simple_html_dom.php” vào thư viện này (link download: http://sourceforge.net/projects/simplehtmldom/files/ )

04

Các bạn nhớ include file mình vừa mới thêm vào nhé:

Và bây giờ sẽ sửa đến file “example.php”:

Thêm hàm này để xác định số điện thoại có trong website:

 

Để in các số điện thoại vừa tìm được thì các bạn làm như sau:

05

Thêm đoạn code này để có thể in ra các số điện thoại.

Các bạn nhớ thay website bạn muốn crawler vào nhé.

$crawler->setURL(“http://”);

Xong ! các bạn có thể lên localhost để chạy thử , chúc các bạn thành công ^^. Lưu ý crawler cần phải kết nối internet nhé.

Các bạn có thể tham khảo tại : http://phpcrawl.cuab.de/ .

Chúc các bạn thành công !

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">