Problems encountered with Php-simple-html-dom-parser

Source: Internet
Author: User
Use this tool today:

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

Encountered a problem, first of all, I used the Php-simple-html-dom-parser testcase in the slick_test.php, on the error, and then I wrote three lines the simplest code to catch Baidu home:


    
     require'./simplehtmldom_1_5/simple_html_dom.php';$html = file_get_html('http://www.baidu.com/');//找到所有图片 foreach($html->find('img') as$element)        echo$element->src . '
'; //找到所有链接 foreach($html->find('a') as$element) echo$element->href . '
';

The resulting error is:

andy@andymacbookpro:/usr/Local/webdata/github/php-simple-html-dom-parser/src/sunra/phpsimple$ PHP andy.phpWww.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
Www.baidu.com/gaoji/preferences.html
/
Https://passport.baidu.com/v2/?login&tpl=mn&u=http%3A%2F%2Fwww.baidu.com%2F
Https://passport.baidu.com/v2/?reg&regType=1&tpl=mn&u=http%3A%2F%2Fwww.baidu.com%2F
/
http://news.baidu.com/ns?cl=2&rn=20&tn=news&word=
Http://tieba.baidu.com/f?kw=&fr=wwwt
Http://zhidao.baidu.com/q?ct=17&pn=0&tn=ikaslist&rn=10&word=&fr=wwwt
http://music.baidu.com/search?fr=ps&key=
http://image.baidu.com/i?tn=baiduimage&ps=1&ct=201326592&lm=-1&cl=2&nc=1&word=
http://v.baidu.com/v?ct=301989888&rn=20&pn=0&db=0&s=25&word=
http://map.baidu.com/m?word=&fr=ps01000
Http://wenku.baidu.com/search?word=&lm=0&od=0
Www.baidu.com/more/
javascript:;
javascript:;
javascript:;
http://w.x.baidu.com/go/mini/8/10000020
Http://news.baidu.com
Http://www.hao123.com
Http://map.baidu.com
Http://v.baidu.com
Http://tieba.baidu.com
Https://passport.baidu.com/v2/?login&tpl=mn&u=http%3A%2F%2Fwww.baidu.com%2F
Www.baidu.com/gaoji/preferences.html
Www.baidu.com/more/
Http://news.baidu.com
Http://tieba.baidu.com
Http://zhidao.baidu.com
Http://music.baidu.com
Http://image.baidu.com
Http://v.baidu.com
Http://map.baidu.com
javascript:;
javascript:;
javascript:;
Http://baike.baidu.com
Http://wenku.baidu.com
Http://www.hao123.com
Www.baidu.com/more/
/
Www.baidu.com/cache/sethelp/index.html
Http://home.baidu.com
Http://ir.baidu.com
/duty/
Create_debugger_socket ("localhost", 9000) Socket:too many open filesCreate_debugger_socket ("localhost",9000)Socket: Too ManyOpenFilesCreate_debugger_socket ("localhost",9000)Socket: Too ManyOpenFilesCreate_debugger_socket ("localhost",9000)Socket: Too ManyOpenFilesCreate_debugger_socket ("localhost",9000)Socket: Too ManyOpenFilesCreate_debugger_socket ("localhost",9000)Socket: Too ManyOpenFilesCreate_debugger_socket ("localhost",9000)Socket: Too ManyOpenFilesCreate_debugger_socket ("localhost",9000)Socket: Too ManyOpenFilesCreate_debugger_socket ("localhost",9000)Socket: Too ManyOpenFilesCreate_debugger_socket ("localhost",9000)Socket: Too ManyOpenFilesCreate_debugger_socket ("localhost",9000)Socket: Too ManyOpenFilesCreate_debugger_socket ("localhost",9000)Socket: Too ManyOpenFilesCreate_debugger_socket ("localhost",9000)Socket: Too ManyOpenFilesCreate_debugger_socket ("localhost",9000)Socket: Too ManyOpenFilesCreate_debugger_socket ("localhost",9000)Socket: Too ManyOpenFilesCreate_debugger_socket ("localhost",9000)Socket: Too ManyOpenFilesCreate_debugger_socket ("localhost",9000)Socket: Too ManyOpenFilesCreate_debugger_socket ("localhost",9000)Socket: Too ManyOpenFilesCreate_debugger_socket ("localhost",9000)Socket: Too ManyOpenFilesCreate_debugger_socket ("localhost",9000)Socket: Too ManyOpenFilesandy@andymacbookpro:/usr/Local/webdata/github/php-simple-html-dom-parser/src/sunra/phpsimple$

This error:

Create_debugger_socket ("localhost", 9000) Socket:too many open files

Do not understand, do not know where to use the socket connection??

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Now fix, is this, first I want to debug the error of PHP to see where the problem, then I opened the MACGDBP, found that after the MACGDBP, unexpectedly did not error, but also think of the 9000 port, this is the corresponding debug port Xdebug, so there is a little thought, It may be a xdebug problem, and then you can refer to this online:

http://bugs.xdebug.org/view.php?id=1070

See here:

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

Then we added a/etc/php.ini to the Xdebug configuration

Xdebug.remote_log =/tmp/xdebug_remote.log

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

16at2015-02-2003:48:2917to configured address/port: localhost:9000.18notto client. :-(  19at2015-02-2003:48:29

Okay, we know. Unable to connect to localhost:9000 socket port, yes, because I did not open macgdbp 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.remote9000xdebug.remote1

If the Xdebug.remote_autostart is set to 1, that is, automatically open, it will directly request the opening of the 9000 port socket connection, if there is no error. The reason is this:-).

OK, because this log file output is quite large, so we can close the 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

Add a semicolon to OK.

The above describes the use of Php-simple-html-dom-parser encountered problems, including aspects of the content, I hope that the PHP tutorial interested in a friend helpful.

  • Related Article

    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.