cURL not working sometimes and gives empty result

Possibly you call too many connections from your curl_init to one Ip Address, So the server blocks the connection and causes the on/off errors.


Not receiving any content back could be due to one or more out of many different reasons and you need to figure out which.

  1. Use curl_error($ch) in your code after the transfer has been performed to see if curl has told you about a problem.

  2. Investigate the response headers. A HTTP transfer can be successful and not return any error but might only respond with HTTP headers and no body at all. The HTTP headers may then contain clues as to why. Perhaps it is a redirect you should follow, perhaps it requires HTTP authentication or perhaps the server indicates a temporary server glitch.