在 URL 上获取 %3F
Getting %3F on URLs
我正在使用 simplehtmldom 并尝试从网站获取所有 链接 。这是我的脚本:
include('simplehtmldom/simple_html_dom.php');
// get DOM from URL or file
$html = file_get_html('http://example.com/urls/');
// find all a tags
foreach($html->find('a') as $e)
echo $e->href . "\n";
我得到的是 urls 的完整列表,但其中一些以 %3F 结尾,其中应该有细绳。类似于:
http://example.com/urls/%3F
而不是:
http://example.com/urls/foo
我做了一些研究,似乎需要在 Apache 服务器 上进行修复,但我无法访问它,有什么我可以做的吗修复它?
像这样解码传入的 url:
echo urldecode($e->href)."\n";
它将给出字符串的解码 url。
我正在使用 simplehtmldom 并尝试从网站获取所有 链接 。这是我的脚本:
include('simplehtmldom/simple_html_dom.php');
// get DOM from URL or file
$html = file_get_html('http://example.com/urls/');
// find all a tags
foreach($html->find('a') as $e)
echo $e->href . "\n";
我得到的是 urls 的完整列表,但其中一些以 %3F 结尾,其中应该有细绳。类似于:
http://example.com/urls/%3F
而不是:
http://example.com/urls/foo
我做了一些研究,似乎需要在 Apache 服务器 上进行修复,但我无法访问它,有什么我可以做的吗修复它?
像这样解码传入的 url:
echo urldecode($e->href)."\n";
它将给出字符串的解码 url。