cURL PHP very slow

I'm noticing that the PHP wrapper using cURL is very slow. On a local version of Apache with PHP it takes about 15 seconds to get the response but the same api call made in a browser gets it in milliseconds.

I've been reading some forums and it seems under some scenarios cURL takes a long time resolving DNS

Is it safe to change the $host from to or it's not a fixed IP?

Any other way to speed up the API call in PHP ?

juanlacueva, 5 years ago

UPDATE: Changing to IP and HTTP (not S) is still taking around 8 seconds and the browser still takes less than half a second. This is not in a shared hosting environment, it's in my own computer both test so I don't know why PHP takes so long. The PHP only calls the API and outputs the content, there's nothing else going on.

See why 200,000 companies worldwide love Campaign Monitor.

From Australia to Zimbabwe, and everywhere in between, companies count on Campaign Monitor for email campaigns that boost the bottom line.

Get started for free