My guess would be
$link = file_get_contents("http://www.abcdef.com/wl/api/allresults?state=".urlencode($location->state)."&page=".urlencode($page));
You might not need the second one if your $page parameter is URL-safe.
My guess would be
$link = file_get_contents("http://www.abcdef.com/wl/api/allresults?state=".urlencode($location->state)."&page=".urlencode($page));
You might not need the second one if your $page parameter is URL-safe.