我试图在页面中找到链接
链接看起来像这个
https://pos.xxxxxxxxxx.de/xxxxxxxxxxxx/app?funnel=login_box&tid=2001004
我隐藏域:(
这就是我的代码:
preg_match('~(https://pos.xxxxxxxxxx.de/xxxxxxxxxx/app'?funnel=login_box&tid='d+)~', $text, $ans);
找不到任何东西。。。
我试试这个
preg_match('~(https://pos.xxxxxxxxxx.de/xxxxxxxxxx/app'?funnel=login_box&tid=)~', $text, $ans);
尝试只查找链接的固定部分。。。
仍然没有
所以我试试这个
preg_match('~(https://pos.xxxxxxxxxx.de/xxxxxxxxxx/app'?funnel=login_box)~', $text, $ans);
现在我找到了一些链接,但为什么我找不到整个链接???
可能在html源中,&
扩展为&
,尝试:
&(amp;)?
只是提醒一下——.
的意思是每个字符,所以你应该转义它,但在这里并不重要。
preg_match("/(https://[^=]+=[^=]++[''d]+(/i",$text,$m(;
如果你在链接的末尾有'或",smth如下href="https://.....">
您可以使用这个:preg_match("/''"(https://[^''"]+(''"/i",$text,$m(;
$html = "http://www.scroogle.org
http://www.scroogle.org/
http://www.scroogle.org/index.html
http://www.scroogle.org/index.html?source=library
You can surf the internet anonymously at https://ssl.scroogle.org/cgi-bin/nbbwssl.cgi.";
preg_match_all('/'b((?P<protocol>https?|ftp):'/'/(?P<domain>[-A-Z0-9.]+)(?P<file>'/[-A-Z0-9+&@#'/%=~_|!:,.;]*)?(?P<parameters>'?[A-Z0-9+&@#'/%=~_|!:,.;]*)?)/i', $html, $urls, PREG_PATTERN_ORDER);
$urls = $urls[1][0];
将匹配:
http://www.scroogle.org
http://www.scroogle.org/
http://www.scroogle.org/index.html
http://www.scroogle.org/index.html?source=library
您可以在匿名上网https://ssl.scroogle.org/cgi-bin/nbbwssl.cgi。
要循环结果,您可以使用:
for ($i = 0; $i < count($urls[0]); $i++) {
echo $urls[1][$i]."'n";
}
将输出:
http://www.scroogle.org
http://www.scroogle.org/
http://www.scroogle.org/index.html
http://www.scroogle.org/index.html?source=library
https://ssl.scroogle.org/cgi-bin/nbbwssl.cgi
欢呼,Lob