Has anyone ever experienced issues with curl or file_get_contents() when using the batch API?
I'm trying to import nodes from a remote data source via batch API; I used file_get_contents() during one phase of development, but then it stopped working.

I can assure that neither curl or file_get_contents() is working, and that they work outside of batch API. Could it be related to how batch API makes its calls via AJAX? The really odd part is that it was working while I was trying to figure out how to get images into a field.

I know it's a really obscure question but I was hoping that someone else had experienced this before.

2 Answers 2


I think it isn't related to batch api.

Drupal has other HTTP client implementation - drupal_http_request()


Batch operations are interrupted every second. If the code is waiting for a reply from the remote server which doesn't reply, then the batch operation gets interrupted before it gets any result.

The code that interrupts the batch operations every second is contained in _batch_process():

// If we are in progressive mode, break processing after 1 second.
if ($batch['progressive'] && timer_read('batch_processing') > 1000) {
  // Record elapsed wall clock time.
  $current_set['elapsed'] = round((microtime(TRUE) - $current_set['start']) * 1000, 2);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.