My website is pausing for a second when running my PHP code. What can I do to speed it up?
I can't put the PHP code at the bottom of the page and use CSS "position: absolute" to move it back to the top because of responsive web design issues with iPhones.
I don't really want to remove the 2 timeouts because if the 3rd party website (blockchain.info) goes offline the page won't load.
The code is for an advertisement to displayed after reading a bitcoin wallet balance. The code you see below is copied 7 times for each of the 7 ads on the page (ad1, ad2, ad3 etc.).
I know HTML and CSS but don't really know much about PHP or javascript/jQuery etc. (but I can copy and paste).
$ch = curl_init('http://whateverlink.com' . $address);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1) ;
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 1);
$ad1 = trim(curl_exec($ch)/100000000);
if ($ad1 > 0.001) {echo
'Display Ad1';
} elseif ($ad1 > -0.0001) {echo
'No ad yet';
}