muppet77 Posted January 26, 2016 Author Share Posted January 26, 2016 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'; Quote Link to comment Share on other sites More sharing options...
Barand Posted January 26, 2016 Share Posted January 26, 2016 try using this to define the constant, instead of a class constant definition define('CERTIFICATE_CHAIN_PATH' , __DIR__ . '/gd_bundle-g2.crt'); Quote Link to comment Share on other sites More sharing options...
muppet77 Posted January 26, 2016 Author Share Posted January 26, 2016 (edited) just realised it is a .cer not .crt changed that part of the code and got this: Certificate chain OK. whoopeee!! Edited January 26, 2016 by muppet77 Quote Link to comment Share on other sites More sharing options...
muppet77 Posted January 26, 2016 Author Share Posted January 26, 2016 (edited) 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 Edited January 26, 2016 by muppet77 Quote Link to comment Share on other sites More sharing options...
QuickOldCar Posted January 28, 2016 Share Posted January 28, 2016 (edited) I have a pretty good curl based scraper that I scrape both http and https sites.That link trying to connect to or even just the domain both return "Unable to fetch website". It's possible they are blocking any requests. There has been known issues with sslv3 due to security issues and some websites are wanting to use TLS instead. To make that matter worse there is issues with TLS in some curl versions. It's like a circle of getting nowhere with it unless use a known working curl version, I believe curl 7.19 for sure has a TLS issue. Here is something that could possibly help or not. curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($curl, CURLOPT_SSL_CIPHER_LIST, 'TLSv1'); curl_setopt($curl, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1); Edited January 28, 2016 by QuickOldCar Quote Link to comment Share on other sites More sharing options...
Jacques1 Posted January 29, 2016 Share Posted January 29, 2016 This will disable certificate verification entirely, leaving the communication wide open to man-in-the-middle attacks and defeating the entire purpose of HTTPS. If you don't care at all about the data you're fetching, and if your entire application is built on the premise that the data can be malicious, then, yes, this might be good enough for a quick hack. But don't use this is a general solution. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.