Jump to content

muppet77

Members
  • Posts

    143
  • Joined

  • Last visited

Everything posted by muppet77

  1. 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 { } ?>
  2. 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.
  3. ignore my post above - all sorted. Barand - your solution works perfectly. Thank you Barand and everyone else.
  4. 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 -->
  5. 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
  6. Thanks. So what would it look like please?
  7. $angle comes from the checkbox entry. (I'm a novice please be gentle!)
  8. 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>
  9. 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
  10. just realised it is a .cer not .crt changed that part of the code and got this: Certificate chain OK. whoopeee!!
  11. 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';
  12. 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
  13. Thanks Barand. Mmmm. Any ideas anyone?
  14. 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?
  15. line 26 is trigger_error('cURL error: '.curl_error($curl), E_USER_ERROR);
  16. thanks Jacques you mean to this? $curl = curl_init(); curl_setopt ($curl, CURLOPT_URL, "https://www.facebook.com/"); curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); $text = curl_exec ($curl); echo $text; curl_close ($curl); yes! this works fine! but alas not for https://www.whoscored.com/Matches/829839/Live still a blank page?
  17. an example of a page that doesn't curl is https://www.facebook.com/ if anyone can get this to work, i'd be thankful. (it's not FB that I'm after but it does the same blank page return as my other page i'm after) https://www.amazon.co.uk/ works fine though? can anyone try it please or offer advice? thank you <?php $curl = curl_init(); curl_setopt ($curl, CURLOPT_URL, "https://www.facebook.com/"); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); $text = curl_exec ($curl); echo $text; curl_close ($curl); ?>
  18. ah, progress, i checked phpinfo() and its said curl was "enabled". i checked the curl commands from post #7 with a few different website that had https - Amazon, BBC etc and they worked!! The one in question returns an absolutely blank page....? mmm, maybe my ip address has been barred from the site that i am after??! Maybe not - it returns a blank page when i log in remotely to work and try finding the page there....? which is good news, i think.
  19. Which library files do I need and where should they be please?
  20. thanks, yes it is the php5.ini contained in my root register_globals = off allow_url_fopen = on upload_max_filesize = 512M post_max_size = 190M expose_php = Off max_input_time = 240 max_execution_time = 240 variables_order = "EGPCS" extension_dir = ./ upload_tmp_dir = /tmp precision = 12 SMTP = relay-hosting.secureserver.net url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=,fieldset=" memory_limit = 512M log_errors = On allow_url_fopen allow_url_include = On extension=php_openssl.dll allow_url_fopen = On extension=php_curl.dll [Zend] zend_extension=/usr/local/zo/ZendExtensionManager.so zend_extension=/usr/local/zo/4_3/ZendOptimizer.so this is my php5.ini.....?
  21. And does the php5 file need to be in the same folder as my script or can it be in the root?
  22. Thanks Jacques. I looked in a file called php5.ini but it doesn't have the extension line at all. I use Godaddy Linux but have a Windows PC. No idea what Apache is. Really sorry I'm new to this! Which file do I need to look for for the library to see if I have it? I've read lots of posts and FAQs and documents abou curl libraries but can't fathom what I need and where.
  23. ok, tried this and nothing printed $curl = curl_init(); curl_setopt ($curl, CURLOPT_URL, "https://www.xxxxxxx.com"); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); $text = curl_exec ($curl); echo $text; curl_close ($curl); any ideas please?Nothing prints, so nothing is in $text variable? Ah wait. Do I need a library or something on my hosting site? Where is it and what do I do? Could this be it? thanks
  24. Ah. Would this line work ? $text = curl_exec ($curl);
  25. Thanks both. How do I get the code I posted into a similar format using curl? $curl = curl_init(); curl_setopt ($curl, CURLOPT_URL, "http://www.xxxxxx.com); curl_exec ($curl); curl_close ($curl); I need the page to equal a variable so I can interrogate the text. That is $text = .......,?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.