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, 4 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.

Join 200,000 companies around the world that use Campaign Monitor to run email marketing campaigns that deliver results for their business.

Get started for free