I’ve been having difficulties creating a random image rotator integrated with Gallery2. I’ve read the wiki, I know why the standard method doesn’t work, and so I’ve been trying to implement alternative methods. Currently the code I’m trying to use is:<?php $ch = curl_init(); $timeout = 5; // set to zero for no timeout curl_setopt ($ch, CURLOPT_URL, 'http://www.mad-science.org/Gallery/main.php?g2_view=imageblock.External&g2_blocks=randomImage&g2_show=title'); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout); $file_contents = curl_exec($ch); curl_close($ch); echo $file_contents; ?>
I insert this code into a template and attempt to update it, however, I get a 503 Error when I try to update the template. I’ve also pasted the code into a PHP file named rotator.php, and I get an output of “1”. What’s going on here?
PHP file: rotator.php