I used this tool today:
https://github.com/sunra/php-simple-html-dom-parser
I encountered a problem. First, I used the built-in php-simple-html-dom-parser slick_test.php in the testcase reported an error, and then I wrote the simplest three lines of code to capture the Baidu homepage:
<code><span><span><?php </span><span>require</span><span>'./simplehtmldom_1_5/simple_html_dom.php'</span>; <span>$html</span> = file_get_html(<span>'http://www.baidu.com/'</span>); <span>//找到所有图片 </span><span>foreach</span>(<span>$html</span>->find(<span>'img'</span>) <span>as</span><span>$element</span>) <span>echo</span><span>$element</span>->src . <span>'<br>'</span>; <span>//找到所有链接 </span><span>foreach</span>(<span>$html</span>->find(<span>'a'</span>) <span>as</span><span>$element</span>) <span>echo</span><span>$element</span>->href . <span>'<br>'</span>;</span></span></code>
The result is:
<code>andy@AndyMacBookPro:/usr/<span>local</span>/webdata/github/php-simple-html-dom-parser/Src/Sunra/PhpSimple$ php andy.php<span> //www.baidu.com/img/baidu_jgylogo3.gif<br>//www.baidu.com/img/bd_logo.png<br>http://s1.bdstatic.com/r/www/cache/static/global/img/gs_237f015b.gif<br>//www.baidu.com/gaoji/preferences.html<br>/<br>https://passport.baidu.com/v2/?login&tpl=mn&u=http%3A%2F%2Fwww.baidu.com%2F<br>https://passport.baidu.com/v2/?reg®Type=1&tpl=mn&u=http%3A%2F%2Fwww.baidu.com%2F<br>/<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/<br>javascript:;<br>javascript:;<br>javascript:;<br>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<br>//www.baidu.com/more/<br>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:;<br>javascript:;<br>javascript:;<br>http://baike.baidu.com<br>http://wenku.baidu.com<br>http://www.hao123.com<br>//www.baidu.com/more/<br>/<br>//www.baidu.com/cache/sethelp/index.html<br>http://home.baidu.com<br>http://ir.baidu.com<br>/duty/<br>create_debugger_socket("localhost", 9000) socket: Too many open files</span> create_debugger_socket(<span>"localhost"</span>, <span>9000</span>) <span>socket</span>: Too many <span>open</span><span>files</span> create_debugger_socket(<span>"localhost"</span>, <span>9000</span>) <span>socket</span>: Too many <span>open</span><span>files</span> create_debugger_socket(<span>"localhost"</span>, <span>9000</span>) <span>socket</span>: Too many <span>open</span><span>files</span> create_debugger_socket(<span>"localhost"</span>, <span>9000</span>) <span>socket</span>: Too many <span>open</span><span>files</span> create_debugger_socket(<span>"localhost"</span>, <span>9000</span>) <span>socket</span>: Too many <span>open</span><span>files</span> create_debugger_socket(<span>"localhost"</span>, <span>9000</span>) <span>socket</span>: Too many <span>open</span><span>files</span> create_debugger_socket(<span>"localhost"</span>, <span>9000</span>) <span>socket</span>: Too many <span>open</span><span>files</span> create_debugger_socket(<span>"localhost"</span>, <span>9000</span>) <span>socket</span>: Too many <span>open</span><span>files</span> create_debugger_socket(<span>"localhost"</span>, <span>9000</span>) <span>socket</span>: Too many <span>open</span><span>files</span> create_debugger_socket(<span>"localhost"</span>, <span>9000</span>) <span>socket</span>: Too many <span>open</span><span>files</span> create_debugger_socket(<span>"localhost"</span>, <span>9000</span>) <span>socket</span>: Too many <span>open</span><span>files</span> create_debugger_socket(<span>"localhost"</span>, <span>9000</span>) <span>socket</span>: Too many <span>open</span><span>files</span> create_debugger_socket(<span>"localhost"</span>, <span>9000</span>) <span>socket</span>: Too many <span>open</span><span>files</span> create_debugger_socket(<span>"localhost"</span>, <span>9000</span>) <span>socket</span>: Too many <span>open</span><span>files</span> create_debugger_socket(<span>"localhost"</span>, <span>9000</span>) <span>socket</span>: Too many <span>open</span><span>files</span> create_debugger_socket(<span>"localhost"</span>, <span>9000</span>) <span>socket</span>: Too many <span>open</span><span>files</span> create_debugger_socket(<span>"localhost"</span>, <span>9000</span>) <span>socket</span>: Too many <span>open</span><span>files</span> create_debugger_socket(<span>"localhost"</span>, <span>9000</span>) <span>socket</span>: Too many <span>open</span><span>files</span> create_debugger_socket(<span>"localhost"</span>, <span>9000</span>) <span>socket</span>: Too many <span>open</span><span>files</span> andy@AndyMacBookPro:/usr/<span>local</span>/webdata/github/php-simple-html-dom-parser/Src/Sunra/PhpSimple$</code>
This error:
create_debugger_socket("localhost", 9000 ) socket: Too many open files
I don’t understand. I wonder where the socket connection is used? ?
%%%%%%%%%%%%%%%%%%%%%%%%%%%
Now it's done, like this, first I wanted to debug the php that went wrong to see what the problem was, then I turned on MacGDBP, and found that after turning on MacGDBp, no error was reported, and I thought of port 9000, which is the counterpart of xdebug Debug port, so I have some ideas, it may be a problem with xdebug, and then I referenced this online:
http://bugs.xdebug.org/view.php?id=1070
See here:
- Installed
- xdebug.remote_log = /tmp/xdebug_remote.log was added to /php.ini for the xdebug configuration. After that, we continued to run and errors continued, but we can see this in the /tmp/xdebug_remote.log file. Error log:
<code><span>16</span> Log opened <span>at</span><span>2015</span>-<span>02</span>-<span>20</span><span>03</span>:<span>48</span>:<span>29</span><span>17</span> I: Connecting <span>to</span> configured address/port: localhost:<span>9000.</span><span>18</span> E: Could <span>not</span> connect <span>to</span> client. :-( <span>19</span> Log closed <span>at</span><span>2015</span>-<span>02</span>-<span>20</span><span>03</span>:<span>48</span>:<span>29</span></code>Okay, we know that we cannot connect to the socket port of localhost:9000. Yes, because I have not opened MacGDBP locally. This is a debugging tool for php. If you are in xdebug of php.ini :
<code>xdebug<span>.remote</span>_enable = on xdebug<span>.remote</span>_handler = dbgp xdebug<span>.remote</span>_host = localhost xdebug<span>.remote</span>_port = <span>9000</span> xdebug<span>.remote</span>_autostart = <span>1</span></code>If xdebug.remote_autostart is set to 1, that is, if it is turned on automatically, it will directly request to open the socket connection of port 9000. If not, an error will be reported. That's why :-). Okay, because the output of this log file is quite large, we can turn off xdebug.remote_log, that is:
<code>xdebug.<span>remote_enable = on</span> xdebug.<span>remote_handler = dbgp</span> xdebug.<span>remote_host = localhost</span> xdebug.<span>remote_port = 9000</span> xdebug.<span>remote_autostart = 1</span> ;xdebug.<span>remote_log = /tmp/xdebug_remote.log</span></code>Add a semicolon and it will be ok.
The above introduces the problems encountered when using php-simple-html-dom-parser, including the content. I hope it will be helpful to friends who are interested in PHP tutorials.

mysql连接不上localhost的原因有mysql服务未启动、mysql端口被占用和MySQL配置文件问题。详细介绍:1、在Windows系统中,可以通过在命令提示符下输入“services.msc”来打开服务管理器,然后找到mysql服务,确保其状态为“运行中”。在Linux系统中,可以使用“services.msc”命令来检查和控制服务状态;2、可以通过打开命令等等。

解决办法:1、检查服务器的运行状态,并确保它正在监听正确的端口;2、尝试暂时禁用防火墙或安全软件,然后重新尝试访问localhost;3、检查操作系统的hosts文件,确保localhost的解析正确;4、尝试重启网络适配器或重新配置网络连接;5、尝试更改本地服务器使用的端口,或关闭其他占用相同端口的程序;6、尝试在hosts文件中手动添加对应的IP地址和域名等等。

一、基于TCP协议的socket套接字编程1、套接字工作流程先从服务器端说起。服务器端先初始化Socket,然后与端口绑定(bind),对端口进行监听(listen),调用accept阻塞,等待客户端连接。在这时如果有个客户端初始化一个Socket,然后连接服务器(connect),如果连接成功,这时客户端与服务器端的连接就建立了。客户端发送数据请求,服务器端接收请求并处理请求,然后把回应数据发送给客户端,客户端读取数据,最后关闭连接,一次交互结束,使用以下Python代码实现:importso

本篇文章给大家带来了关于php+socket的相关知识,其中主要介绍了IO多路复用,以及php+socket如何实现web服务器?感兴趣的朋友下面一起来看一下,希望对大家有帮助。

SpringBoot端第一步,引入依赖首先我们需要引入WebSocket所需的依赖,以及处理输出格式的依赖com.alibabafastjson1.2.73org.springframework.bootspring-boot-starter-websocket第二步,创建WebSocket配置类importorg.springframework.context.annotation.Bean;importorg.springframework.context.annotation.Config

linux localhost的意思是“计算机主机名”,主机名用于在网络上识别独立的计算机;在“root@localhost”中的root代表当前登录的用户,在Linux中管理员账户是root,用户以root身份登录到linux本机。

php socket无法连接的解决办法:1、检查php是否开启socket扩展;2、打开php.ini文件,检查“php_sockets.dll”是否被加载;3、取消“php_sockets.dll”的注释状态即可。

comcn和com的区别:1、comcn和com在含义等方面有区别,在访问速度上没有区别;2、comcn属于国际域名,是全球通用顶级域名,供商业机构使用,而cn是中国的公司域名,国内商业机构,国内域名,必须企业才可以备案;3、搜索的优先顺序是cn先会去搜索.cn,找到.cn服务器后,再由.cn服务器搜索.com;4、cn由cnnic中国互联网中心管理,com的管理机构在国外。


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

SublimeText3 Linux new version
SublimeText3 Linux latest version

Notepad++7.3.1
Easy-to-use and free code editor

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

Dreamweaver CS6
Visual web development tools
