Are you sure that you're getting a valid web feed back? You should probably check $res->is_error before trying to parse the content that you get ...
Lee mas