zzjzz9266a / 91porn_php

最简单的91porn爬虫php版本
603 stars 171 forks source link

运行php文件报错:PHP Notice: Undefined offset: 1 in /91porn_php/detailPage.php等 #8

Open justwjx opened 5 years ago

justwjx commented 5 years ago

环境是DSM5.2, Docker 安装的 CentOS latest版本

日志如下,倒着看

2018-12-05 04:50:36,stdout, thrown in /91porn_php/vendor/imangazaliev/didom/src/DiDom/Document.php on line 358

2018-12-05 04:50:36,stdout,#4 {main}

2018-12-05 04:50:36,stdout,#3 /91porn_php/91porn.php(24): listPage()

2018-12-05 04:50:36,stdout,"#2 /91porn_php/91porn.php(12): DiDom\Document->__construct('http://91porn.c...', true, 'User-Agent:Mozi...') " 2018-12-05 04:50:36,stdout,"#1 /91porn_php/vendor/imangazaliev/didom/src/DiDom/Document.php(69): DiDom\Document->load('http://91porn.c...', true, 'html') " 2018-12-05 04:50:36,stdout,#0 /91porn_php/vendor/imangazaliev/didom/src/DiDom/Document.php(241): DiDom\Document->loadFile('http://91porn.c...')

2018-12-05 04:50:36,stdout,Stack trace:

2018-12-05 04:50:36,stdout,PHP Fatal error: Uncaught exception 'RuntimeException' with message 'Could not load file http://91porn.com/index.php' in /91porn_php/vendor/imangazaliev/didom/src/DiDom/Document.php:358

2018-12-05 04:50:36,stdout,PHP Warning: file_get_contents(http://91porn.com/index.php): failed to open stream: HTTP request failed! in /91porn_php/vendor/imangazaliev/didom/src/DiDom/Document.php on line 349

2018-12-05 04:50:36,stdout,PHP Notice: Undefined offset: 1 in /91porn_php/detailPage.php on line 15

2018-12-05 04:50:36,stdout,]0;@centos1:/91porn_php[root@centos1 91porn_php]# php 91porn.php

zzjzz9266a commented 5 years ago

参照#7 ,加sudo

justwjx commented 5 years ago

参照#7 ,加sudo

还是一样的错误,我的是群晖Docker环境下的CentOS,和你给的链接还有些区别。

[root@centos1 /]# cd /etc/91porn_php
bash: cd: /etc/91porn_php: No such file or directory
[root@centos1 /]# ls
91porn_php bin etc lib media opt root sbin sys usr
anaconda-post.log dev home lib64 mnt proc run srv tmp var
[root@centos1 /]# cd /91porn_php
[root@centos1 91porn_php]# sudo php 91porn.php
PHP Notice: Undefined offset: 1 in /91porn_php/detailPage.php on line 15
PHP Warning: file_get_contents(http://91porn.com/index.php): failed to open stream: HTTP reques t failed! in /91porn_php/vendor/imangazaliev/didom/src/DiDom/Document.php on line 349
PHP Fatal error: Uncaught exception 'RuntimeException' with message 'Could not load file http:/ /91porn.com/index.php' in /91porn_php/vendor/imangazaliev/didom/src/DiDom/Document.php:358
Stack trace:

0 /91porn_php/vendor/imangazaliev/didom/src/DiDom/Document.php(241): DiDom\Document->loadFile('

http://91porn.c...')

1 /91porn_php/vendor/imangazaliev/didom/src/DiDom/Document.php(69): DiDom\Document->load('http:

//91porn.c...', true, 'html')

2 /91porn_php/91porn.php(12): DiDom\Document->__construct('http://91porn.c...', true, 'User-Age

nt:Mozi...')

3 /91porn_php/91porn.php(24): listPage()

4 {main}

thrown in /91porn_php/vendor/imangazaliev/didom/src/DiDom/Document.php on line 358

zzjzz9266a commented 5 years ago

目测是因为你那过不了墙,拿不到内容导致的,你在翻墙环境下试试看

justwjx commented 5 years ago

目测是因为你那过不了墙,拿不到内容导致的,你在翻墙环境下试试看

不是被墙的原因,我已经挂了代理,可以正常ping通

[root@centos1 /]# ping 91porn.com
PING 91porn.com (104.27.133.103) 56(84) bytes of data.
64 bytes from 104.27.133.103 (104.27.133.103): icmp_seq=1 ttl=54 time=153 ms
64 bytes from 104.27.133.103 (104.27.133.103): icmp_seq=2 ttl=54 time=152 ms
64 bytes from 104.27.133.103 (104.27.133.103): icmp_seq=3 ttl=54 time=152 ms
64 bytes from 104.27.133.103 (104.27.133.103): icmp_seq=4 ttl=54 time=152 ms
64 bytes from 104.27.133.103 (104.27.133.103): icmp_seq=5 ttl=54 time=152 ms
^C
--- 91porn.com ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4002ms
rtt min/avg/max/mdev = 152.182/152.433/153.085/0.330 ms
[root@centos1 /]# cd /91porn_php
[root@centos1 91porn_php]# sudo php 91porn.php
PHP Notice: Undefined offset: 1 in /91porn_php/detailPage.php on line 15
PHP Warning: file_get_contents(http://91porn.com/index.php): failed to open stream: HTTP reques
t failed! in /91porn_php/vendor/imangazaliev/didom/src/DiDom/Document.php on line 349
PHP Fatal error: Uncaught exception 'RuntimeException' with message 'Could not load file http:/
/91porn.com/index.php' in /91porn_php/vendor/imangazaliev/didom/src/DiDom/Document.php:358
Stack trace:

0 /91porn_php/vendor/imangazaliev/didom/src/DiDom/Document.php(241): DiDom\Document->loadFile('

http://91porn.c...')

1 /91porn_php/vendor/imangazaliev/didom/src/DiDom/Document.php(69): DiDom\Document->load('http:

//91porn.c...', true, 'html')

2 /91porn_php/91porn.php(12): DiDom\Document->__construct('http://91porn.c...', true, 'User-Age

nt:Mozi...')

3 /91porn_php/91porn.php(24): listPage()

4 {main}

thrown in /91porn_php/vendor/imangazaliev/didom/src/DiDom/Document.php on line 358

zzjzz9266a commented 5 years ago
root@ZhijieCloud:/volume1/downloads/91porn_php# ping 91porn.com
PING 91porn.com (104.27.132.103) 56(84) bytes of data.
64 bytes from 104.27.132.103: icmp_seq=1 ttl=51 time=182 ms
64 bytes from 104.27.132.103: icmp_seq=2 ttl=51 time=182 ms
64 bytes from 104.27.132.103: icmp_seq=3 ttl=51 time=182 ms
64 bytes from 104.27.132.103: icmp_seq=4 ttl=51 time=182 ms
64 bytes from 104.27.132.103: icmp_seq=5 ttl=51 time=182 ms
64 bytes from 104.27.132.103: icmp_seq=6 ttl=51 time=183 ms
^C
--- 91porn.com ping statistics ---
6 packets transmitted, 6 received, 0% packet loss, time 5770ms
rtt min/avg/max/mdev = 182.024/182.424/183.050/0.670 ms
root@ZhijieCloud:/volume1/downloads/91porn_php# php 91porn.php
PHP Warning:  file_get_contents(http://91porn.com/index.php): failed to open stream: HTTP request failed!  in /volume1/downloads/91porn_php/vendor/imangazaliev/didom/src/DiDom/Document.php on line 349

Warning: file_get_contents(http://91porn.com/index.php): failed to open stream: HTTP request failed!  in /volume1/downloads/91porn_php/vendor/imangazaliev/didom/src/DiDom/Document.php on line 349
PHP Fatal error:  Uncaught exception 'RuntimeException' with message 'Could not load file http://91porn.com/index.php' in /volume1/downloads/91porn_php/vendor/imangazaliev/didom/src/DiDom/Document.php:358
Stack trace:
#0 /volume1/downloads/91porn_php/vendor/imangazaliev/didom/src/DiDom/Document.php(241): DiDom\Document->loadFile('http://91porn.c...')
#1 /volume1/downloads/91porn_php/vendor/imangazaliev/didom/src/DiDom/Document.php(69): DiDom\Document->load('http://91porn.c...', true, 'html')
#2 /volume1/downloads/91porn_php/91porn.php(21): DiDom\Document->__construct('http://91porn.c...', true, 'User-Agent:Mozi...')
#3 /volume1/downloads/91porn_php/91porn.php(33): listPage()
#4 {main}
  thrown in /volume1/downloads/91porn_php/vendor/imangazaliev/didom/src/DiDom/Document.php on line 358

Fatal error: Uncaught exception 'RuntimeException' with message 'Could not load file http://91porn.com/index.php' in /volume1/downloads/91porn_php/vendor/imangazaliev/didom/src/DiDom/Document.php:358
Stack trace:
#0 /volume1/downloads/91porn_php/vendor/imangazaliev/didom/src/DiDom/Document.php(241): DiDom\Document->loadFile('http://91porn.c...')
#1 /volume1/downloads/91porn_php/vendor/imangazaliev/didom/src/DiDom/Document.php(69): DiDom\Document->load('http://91porn.c...', true, 'html')
#2 /volume1/downloads/91porn_php/91porn.php(21): DiDom\Document->__construct('http://91porn.c...', true, 'User-Agent:Mozi...')
#3 /volume1/downloads/91porn_php/91porn.php(33): listPage()
#4 {main}
  thrown in /volume1/downloads/91porn_php/vendor/imangazaliev/didom/src/DiDom/Document.php on line 358
root@ZhijieCloud:/volume1/downloads/91porn_php#

亲测就是没过墙,我是在路由器上开了ss,并且把91porn.com加了黑名单