How to update multiple records with API?
You can use chaining:

civicrm_api3('Contact', 'get', array(
  'return' =&gt; 'id', // more efficient since you don't care about the get results
  ... other search params ...
  'api.Contact.create' =&gt; array('last_name' =&gt; 'Something'),
));


The 'id' will be set for you automatically by the chaining. For more about chaining see this post.

Also remember the 'gotcha' that unless you specify otherwise, this will only fetch &amp; update 25 records.