
muppet77
Members-
Posts
143 -
Joined
-
Last visited
Profile Information
-
Gender
Not Telling
muppet77's Achievements
-
Hi all. I have a script that takes some photos from files that are organised by date and hour and minute on my hosting site and then rotates through them displaying them in turn. It used to work fine about a week ago until I renewed my SSL certificate. No idea if this is to do with it..? Now the script shows one photo and then goes blank and then displays a message - “can’t open this page. ” Any ideas? Thank you <?php date_default_timezone_set('Europe/London'); $date = date("Y-m-d"); $dir = './5L096B7PAG30CB5/'.$date.'/001/jpg/'; $imagesList = array(); foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir)) as $filename) { if ($filename->isDir()) continue; $imagesList[] = str_replace("\\","/",$filename->getPathname()); } //print_r($imagesList); $numberimages = count($imagesList); echo $numberimages; ?> <html lang="en"> <head> <title>cam</title> <style> body {font-family:Arial, Helvetica, sans-serif; font-size:12px;} .fadein { position:relative; height:90%; width:90%; margin:0 auto; padding: 10px; } .fadein img{ position:absolute; width: calc(100%); height: calc(100%); object-fit: scale-down; } </style> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> <script> $(function(){ $('.fadein img:gt(0)').hide(); setInterval(function(){$('.fadein :first-child').fadeOut().next('img').fadeIn().end().appendTo('.fadein'); }, 111); }); </script> </head> <body> <div class="fadein"> <?php //$scan_dir = scandir($dir); foreach($imagesList as $img): if(in_array($img,array('.','..'))) continue; ?> <img src="<?php echo $img ?>" alt="<?php echo $img ?>"> <?php endforeach; ?> </div> </body> </html> <?php // clear all folder older than x days $days = 0.5; $dir = './5L096B7PAG30CB5/'; $now = time(); $dir = new \RecursiveDirectoryIterator($dir, \FilesystemIterator::SKIP_DOTS); $dir = new \RecursiveIteratorIterator($dir,\RecursiveIteratorIterator::CHILD_FIRST); $deleteFiles =[]; $message = "There is no file to delete"; if($dir) { foreach ($dir as $file) { /* Comparing the current time with the time when file was created */ if ($file && $now - filemtime($file) >= 60 * 60 * 24 * $days) { // days array_push($deleteFiles, $file); $file->isDir() ? rmdir($file) : unlink($file); $message = "All the following files are deleted.<br/>"; } } }else { } ?>
-
Hi, I am trying to grab some data from a site, but my blocker at the moment is that the site has a button near the end of the page, that opens up more data. It's th ebutton that says "Show All" Using file get contents, I don't get this "hidden data". Any ideas please? I'm a novice and am using this code: echo strip_tags(file_get_contents("http://www.sportinglife.com/football/live/vidiprinter")); Thank you.
-
ignore my post above - all sorted. Barand - your solution works perfectly. Thank you Barand and everyone else.
-
Thanks Barand. Had a quick go but couldn't get it going. Should there be some php in there? Eg rather than your <input type="hidden" name="goalie1" value="<?=$goalie?>"> <!-- store the goalie value in a hidden field --> Should it be <input type="hidden" name="goalie1" value="<?php echo $goalie ?>"> <!-- store the goalie value in a hidden field -->
-
The complication in my head is that $angle has to be a user input but $goaly1 is calculated in the php code above. Both need to be sent to penalty.php
-
Thanks. So what would it look like please?
-
$angle comes from the checkbox entry. (I'm a novice please be gentle!)
-
I am trying to send a php variable called $angle to another script called penalty.php along with an already establish variable called $goaly1 in a URL send method but can't get it going. I have the $goaly1 variable working on its own and I've added in the $angle form so it's probably that bit of the script that doesn't gel. Do I need the penalty.php instruction twice for example? Any suggestions would be appreciated. <html> <body> <form method="post" action="penalty.php"> <input type="checkbox" name="angle" value="1">Angle?</input> <?php $angle = $_POST['angle']; ?> <a href='penalty.php? angle=<?php echo $angle ?>& goaly1=<?php echo $goaly1 ?> '> draw it</a> </html>
-
ok, i then printed the absolute path and then put this path back into the original script to get <?php const FETCH_URL = 'https://www.whoscored.com/Matches/829839/Live'; $curl = curl_init(FETCH_URL); curl_setopt($curl, CURLOPT_CAINFO, '/home/content/m/u/p/muppet77/html/footballstatistics.co/gd_bundle-g2.cer'); if (!$curl) { trigger_error('Failed to initialize cURL.', E_USER_ERROR); } if (!curl_setopt($curl, CURLOPT_RETURNTRANSFER, true)) { trigger_error('Failed to set cURL option.', E_USER_ERROR); } if (!curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true)) { trigger_error('Failed to set cURL option.', E_USER_ERROR); } $curl_response = curl_exec($curl); if ($curl_response === false) { trigger_error('cURL error: '.curl_error($curl), E_USER_ERROR); } echo $curl_response; curl_close($curl); ?> which output the same output error as post #19 Fatal error: cURL error: Unknown SSL protocol error in connection to www.whoscored.com:443 in /home/content/m/u/p/muppet77/html/footballstatistics.co/test.php on line 26
-
just realised it is a .cer not .crt changed that part of the code and got this: Certificate chain OK. whoopeee!!
-
Parse error: syntax error, unexpected '.', expecting ',' or ';' in /home/content/m/u/p/muppet77/html/footballstatistics.co/test3.php on line 3 which is this line const CERTIFICATE_CHAIN_PATH = __DIR__.'/gd_bundle-g2.crt';
-
thank you for your help Jacques, I feel that we are close now. This scipt <?php const FETCH_URL = 'https://www.whoscored.com/Matches/829839/Live'; $curl = curl_init(FETCH_URL); curl_setopt($curl, CURLOPT_CAINFO, 'gd_bundle-g2.crt'); if (!$curl) { trigger_error('Failed to initialize cURL.', E_USER_ERROR); } if (!curl_setopt($curl, CURLOPT_RETURNTRANSFER, true)) { trigger_error('Failed to set cURL option.', E_USER_ERROR); } if (!curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true)) { trigger_error('Failed to set cURL option.', E_USER_ERROR); } $curl_response = curl_exec($curl); if ($curl_response === false) { trigger_error('cURL error: '.curl_error($curl), E_USER_ERROR); } echo $curl_response; curl_close($curl); ?> now gives this as you can see i added the certificate to the same folder as the script called test.php
-
Thanks Barand. Mmmm. Any ideas anyone?
-
Please could a volunteer run the code in post 18 and see if it returns the page or gets an error code? Wondering if it is just me?
-
line 26 is trigger_error('cURL error: '.curl_error($curl), E_USER_ERROR);