Problems with php-simple-html-dom-parser

Source: Internet
Author: User
: This article mainly introduces the problems encountered when using php-simple-html-dom-parser. For more information about PHP tutorials, see. Use this tool today:

Https://github.com/sunra/php-simple-html-dom-parser

First, I used slick_test.php in php-simple-html-dom-parser's testcase to report an error, then I wrote three lines of the simplest code to capture the Baidu homepage:


  Find ('IMG ') as $ element) echo $ element-> src .'
'; // Find all links, foreach ($ html-> find ('A') as $ element) echo $ element-> href .'
';

The error message is:

andy@AndyMacBookPro:/usr/local/webdata/github/php-simple-html-dom-parser/Src/Sunra/PhpSimple$ php andy.php//www.baidu.com/img/baidu_jgylogo3.gif
//www.baidu.com/img/bd_logo.png
http://s1.bdstatic.com/r/www/cache/static/global/img/gs_237f015b.gif<br>//www.baidu.com/gaoji/preferences.html
/
https://passport.baidu.com/v2/?login&tpl=mn&u=http%3A%2F%2Fwww.baidu.com%2F<br>https://passport.baidu.com/v2/?reg&regType=1&tpl=mn&u=http%3A%2F%2Fwww.baidu.com%2F<br>/
http://news.baidu.com/ns?cl=2&rn=20&tn=news&word=<br>http://tieba.baidu.com/f?kw=&fr=wwwt<br>http://zhidao.baidu.com/q?ct=17&pn=0&tn=ikaslist&rn=10&word=&fr=wwwt<br>http://music.baidu.com/search?fr=ps&key=<br>http://image.baidu.com/i?tn=baiduimage&ps=1&ct=201326592&lm=-1&cl=2&nc=1&word=<br>http://v.baidu.com/v?ct=301989888&rn=20&pn=0&db=0&s=25&word=<br>http://map.baidu.com/m?word=&fr=ps01000<br>http://wenku.baidu.com/search?word=&lm=0&od=0<br>//www.baidu.com/more/
javascript:;
javascript:;
javascript:;
http://w.x.baidu.com/go/mini/8/10000020<br>http://news.baidu.com<br>http://www.hao123.com<br>http://map.baidu.com<br>http://v.baidu.com<br>http://tieba.baidu.com<br>https://passport.baidu.com/v2/?login&tpl=mn&u=http%3A%2F%2Fwww.baidu.com%2F<br>//www.baidu.com/gaoji/preferences.html
//www.baidu.com/more/
http://news.baidu.com<br>http://tieba.baidu.com<br>http://zhidao.baidu.com<br>http://music.baidu.com<br>http://image.baidu.com<br>http://v.baidu.com<br>http://map.baidu.com<br>javascript:;
javascript:;
javascript:;
http://baike.baidu.com<br>http://wenku.baidu.com<br>http://www.hao123.com<br>//www.baidu.com/more/
/
//www.baidu.com/cache/sethelp/index.html
http://home.baidu.com<br>http://ir.baidu.com<br>/duty/
create_debugger_socket("localhost", 9000) socket: Too many open filescreate_debugger_socket("localhost", 9000) socket: Too many openfilescreate_debugger_socket("localhost", 9000) socket: Too many openfilescreate_debugger_socket("localhost", 9000) socket: Too many openfilescreate_debugger_socket("localhost", 9000) socket: Too many openfilescreate_debugger_socket("localhost", 9000) socket: Too many openfilescreate_debugger_socket("localhost", 9000) socket: Too many openfilescreate_debugger_socket("localhost", 9000) socket: Too many openfilescreate_debugger_socket("localhost", 9000) socket: Too many openfilescreate_debugger_socket("localhost", 9000) socket: Too many openfilescreate_debugger_socket("localhost", 9000) socket: Too many openfilescreate_debugger_socket("localhost", 9000) socket: Too many openfilescreate_debugger_socket("localhost", 9000) socket: Too many openfilescreate_debugger_socket("localhost", 9000) socket: Too many openfilescreate_debugger_socket("localhost", 9000) socket: Too many openfilescreate_debugger_socket("localhost", 9000) socket: Too many openfilescreate_debugger_socket("localhost", 9000) socket: Too many openfilescreate_debugger_socket("localhost", 9000) socket: Too many openfilescreate_debugger_socket("localhost", 9000) socket: Too many openfilescreate_debugger_socket("localhost", 9000) socket: Too many openfilesandy@AndyMacBookPro:/usr/local/webdata/github/php-simple-html-dom-parser/Src/Sunra/PhpSimple$

This error is reported:

Create_debugger_socket ("localhost", 9000) socket: Too program open files

I don't know where the socket connection is used ??

%
Now we have done this. first, I want to debug the wrong php to see where the problem is. then I started MacGDBP and found that after MacGDBp was enabled, no error was reported, I also think of port 9000, which is the corresponding debugging port of xdebug. so I have a bit of thought, maybe it is the problem of xdebug, and I will refer to it on the Internet:

Http://bugs.xdebug.org/view.php? Id = 1070

Here:

  • Installed Xdebug, and set xdebug. remote_connect_back and xdebug. remote_enable to 1 so that it connects to my host, running (or not running phpstorm)
  • Set xdebug. remote_log =/tmp/remote. log

Then we added the xdebug configuration to/etc/php. ini.

Xdebug. remote_log =/tmp/xdebug_remote.log

Then we continue to run and continue with the error, but we can see this error log in the/tmp/xdebug_remote.log file:

16 Log opened at2015-02-2003:48:2917 I: Connecting to configured address/port: localhost:9000.18 E: Could not connect to client. :-(  19 Log closed at2015-02-2003:48:29

Okay, we know we cannot connect to the socket port of localhost: 9000. Yes, because MacGDBP is not enabled locally. this is a debugging tool for php. if you are in php. ini xdebug here:

xdebug.remote_enable = onxdebug.remote_handler = dbgpxdebug.remote_host = localhostxdebug.remote_port = 9000xdebug.remote_autostart = 1

If xdebug. remote_autostart is set to 1, that is, if it is automatically enabled, the system directly requests to enable socket connection on port 9000. if it does not, an error is returned. The reason is :-).

Well, because the output of this log file is quite large, we can close xdebug. remote_log, that is:

xdebug.remote_enable = onxdebug.remote_handler = dbgpxdebug.remote_host = localhostxdebug.remote_port = 9000xdebug.remote_autostart = 1;xdebug.remote_log = /tmp/xdebug_remote.log

The extra points are OK.

The above describes the problems encountered when using php-simple-html-dom-parser, including some content, and hope to help those who are interested in PHP tutorials.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.