保存在变量PHP中后无法处理卷曲响应

$ch = curl_init("http://acrs.bboxpr.com/getAddress.php?lat=35.545112&lng=-90.657635");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
$address = curl_exec($ch);       
curl_close($ch);

//prints the address
echo $address;

//$token = strtok($address, ",");
//$phaddress=array();
//while ($token != null)
//{
//array_push($phaddress,$token);
//$token = strtok(",");
//}
//print_r($phaddress); //blank

In the line echo $address; will print in the content in the page, but if I uncomment the code below(the one that starts with: $token=strtok),$address will look empty. I added more code that uses the results with $address (but I did not include that in here) and sometimes appears the source-code of the site that is invoked in the curl initialization. So I think maybe curl is taking a little bit longer, but I tried to put a sleep before srtok, but didn't work.

Since you are tying to get MAP information from google i think you are using the wrong approch my using javascript because that might be more difficult to parse

Why don't you try using PHP directly

$ch = curl_init("http://maps.google.com/maps/api/geocode/json?latlng=35.545112,-90.657635&sensor=false");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
$return = curl_exec($ch);
curl_close($ch);
$geoOutput = json_decode($return,true);
echo "<pre>" ;

foreach($geoOutput as $key => $data)
{
    if(is_array($data))
    {
        foreach($data as $cKey => $cData)
        {
            var_dump($cData['formatted_address']);
        }
    }
}

Output

string(43) "6724-6916 Bay Ln, Harrisburg, AR 72432, USA"
string(16) "Bolivar, AR, USA"
string(25) "Harrisburg, AR 72432, USA"
string(17) "Poinsett, AR, USA"
string(13) "Arkansas, USA"

In your while loop, you have to replace $token = strtok(","); with $token = strtok($address, ",");

Change your while loop to this: while ($token !== false)