Benji Wilson
Benji Wilson

Reputation: 53

preg_match_all(): Compilation failed: nothing to repeat at offset 203 runescape

Can someone please tell me why this wont work?

I am getting error "preg_match_all(): Compilation failed: nothing to repeat at offset 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);

Example url that would be used in the file_get_contents

http://services.runescape.com/m=itemdb_rs/results.ws?query=gold%20bar&price=all&members=no

Thank you :)

Upvotes: 0

Views: 1272

Answers (1)

Touki
Touki

Reputation: 7525

I suggest your error is right here :

<td class="(.*?)">(.?*)</td></tr>#

Replace by

<td class="(.*?)">(.*?)</td></tr>#

Upvotes: 1

Related Questions