Thank you so much for your help! You made my day!
And thanks to anyone who tried to help!
It was indeed the & character who messed up. Somehow the script has the when entering the urls in the database the & to &&, which had to be changed back
$ratingurl = str_replace('&','&',$ratingurl);
The url was originally fetched with preg_match_all and was entered directly into database