0
有人可以告诉我为什么这不会工作?preg_match_all():编译失败:没有重复的偏移量203 runescape
我收到错误 “preg_match_all():编译失败:没有重复的偏移203”
$html = file_get_contents('http://services.runescape.com/m=itemdb_rs/results.ws?query='.urlencode($term).'&price='.$pricerange.'&members='.$members);
$html = str_replace(array("\r","\n"), "", $html);
$regexp = '#<tr data-item-id="(.*?)"><td class="(.*?)"><img src="(.*?)" alt="(.*?)"><a href="(.*?)">(.*?)</a></td><td><img src="(.*?)" alt="(.*?)" title="(.*?)"></td><td class="(.*?)">(.*?)</td><td class="(.*?)">(.?*)</td></tr>#';
preg_match_all($regexp, $html, $matches);
print_r($matches);
示例URL会在的file_get_contents
http://services.runescape.com/m=itemdb_rs/results.ws?query=gold%20bar&price=all&members=no
感谢您使用:)
你能提供的完整网址是'file_get_contents'内的个例?没有它,我们无法帮助你。 – j0k
我建议使用[DOM](http://ar2.php.net/manual/en/book.dom.php)而不是正则表达式。它更可靠。 – Leri
已经为file_get_contents添加了一个完整的URL示例:) –