合并两个PHP - Kimonlabs

Kimonlabs JSON Code

$json_string = file_get_contents("http://www.kimonolabs.com/api/e45oypq8?apikey=XXX");
$parsed_json = json_decode($json_string);
//var_dump($parsed_json->results->collection1);

foreach($parsed_json->results->collection1 as $collection){
echo $collection->title->text . ''; echo $collection->title->href . ''; echo $collection->posted . '';
}

PHP Redirect Code

header( 'Location: http://www.yoursite.com/new_page.html' ) ; 

I'd like to replace

http://www.yoursite.com/new_page.html
with
$collection->title->href

But I've no idea how to merge the two.

Since a foreach() is used, I doubt you can do that... If there are multiple results, your code is going to try to redirect multiple times to a different url (or at least the first it encounters).

$json_string = file_get_contents("http://www.kimonolabs.com/api/e45oypq8?apikey=XXX");
$parsed_json = json_decode($json_string);
//var_dump($parsed_json->results->collection1);

foreach($parsed_json->results->collection1 as $collection){
    header('Location: ' . $collection->title->href);
    die();
}