This should do the trick.
$result = array();
//loop through responseheader array
foreach($data['responseheader'] as $row)
{
//if the id exists in the response array add it to the result array
if(array_key_exists($row['id'], $data['response'])) {
$result[] = $data['response'][$row['id']]['content'][0];
}
}
print_r($result);
If the content in response could contain more than one content you have to loop throught it to:
foreach($data['response'][$row['id']]['content'] as $content) {
$result[] = $content;
}