Where is the result of the query is stored?
You could get the nids like this:

// load and display view
$view = views_get_view('view_name');
$view-&gt;set_display('block_1');
$view-&gt;execute();
$nids = [];
// get all nids from the result 
foreach ($view-&gt;result as $result) {
   $nids[] = $result-&gt;nid;
}
// render view
print $view-&gt;render();