Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
350 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,30 @@ | ||
# FDJScraper | ||
### English | ||
Euromillions & Loto Php Scraper. | ||
Get the latest lottery results (Euromillions & French Loto) by scraping the FDJ site in PHP. | ||
### French | ||
Scraper Php Euromillions & Loto France. | ||
Récupérez les derniers résultats du loto en scrapant le site de la FDJ en PHP. | ||
### Screenshot | ||
![Screenshot](capture.png) | ||
# FDJ PHP SCRAPER | ||
Simple EuroMillions & Loto PHP Scraper. | ||
|
||
Get the latest lottery results (Euromillions & French Loto) by scraping the FDJ website in PHP. | ||
|
||
## Version 1.1.0 | ||
- Update to Bootstrap 4 | ||
- Replace javascript one page system by multiples php pages | ||
- Add Font Awesome 4.7.0 | ||
- Add SEO Optimizations (Title & Meta Description) | ||
- Add robots.txt | ||
- Add changelog.txt | ||
- Add Favicon | ||
- Add demonstration link | ||
|
||
## Demo | ||
https://demo.t-php.fr/fdj-scraper/ | ||
|
||
## Preview | ||
![Screenshot 1](img/screen1.png) | ||
|
||
![Screenshot 2](img/screen2.png) | ||
|
||
![Screenshot 3](img/screen3.png) | ||
|
||
## Installation | ||
1. Download script | ||
2. Unzip the package | ||
3. Transfer on your server (local or online) | ||
4. It's finish ! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
*** 03/02/2018 : v1.1.0 *** | ||
- Update to Bootstrap 4 | ||
- Replace javascript one page system by multiples php pages | ||
- Add Font Awesome 4.7.0 | ||
- Add SEO Optimizations (Title & Meta Description) | ||
- Add robots.txt | ||
- Add changelog.txt | ||
- Add favicon | ||
- Add demonstration link | ||
*** 03/07/2017 : v1.0.0 *** | ||
- First version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
:root { | ||
--jumbotron-padding-y: 1.5rem; | ||
} | ||
|
||
.jumbotron { | ||
padding-top: var(--jumbotron-padding-y); | ||
padding-bottom: var(--jumbotron-padding-y); | ||
margin-bottom: 0; | ||
background-color: #fff; | ||
} | ||
@media (min-width: 768px) { | ||
.jumbotron { | ||
padding-top: calc(var(--jumbotron-padding-y) * 2); | ||
padding-bottom: calc(var(--jumbotron-padding-y) * 2); | ||
} | ||
} | ||
|
||
.jumbotron p:last-child { | ||
margin-bottom: 0; | ||
} | ||
|
||
.jumbotron-heading { | ||
font-weight: 300; | ||
} | ||
|
||
.jumbotron .container { | ||
max-width: 40rem; | ||
} | ||
|
||
footer { | ||
padding-top: 3rem; | ||
padding-bottom: 3rem; | ||
} | ||
|
||
footer p { | ||
margin-bottom: .25rem; | ||
} | ||
|
||
.box-shadow { box-shadow: 0 .25rem .75rem rgba(0, 0, 0, .05); } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
<?php | ||
//SEO | ||
$seo['title'] = "Derniers Résultats EuroMillions"; | ||
$seo['meta_description'] = ""; | ||
//Include Header Page | ||
include ('header.php'); | ||
//Define URL FDJ to scrap | ||
$urlhn = "https://www.fdj.fr/jeux/jeux-de-tirage/euromillions/resultats"; | ||
//Identify elements to scrap | ||
$input = @file_get_contents($urlhn) or die("Impossible to get : $urlhn"); | ||
$getDate = '<h3 class="dateTirage mt20 fl">(.*)<\/h3>'; | ||
$getNumbers = '<p class="euro_num">(.*)<\/p>'; | ||
$getChance = '<p class="euro_num_c">(.*)<\/p>'; | ||
$getMyMillion = '<p class="tirage_my_million"><span>(.*)<\/span><\/p>'; | ||
$getGains = '<table class="tableErgo" cellspacing="0">(.*)<\/table>'; | ||
?> | ||
|
||
<main role="main"> | ||
<section class="jumbotron text-center"> | ||
<div class="container"> | ||
<h1 class="jumbotron-heading text-uppercase">Derniers Résultats EuroMillions</h1> | ||
<?php if(preg_match_all("/$getNumbers/siU", $input, $numbers, PREG_SET_ORDER) | ||
AND (preg_match_all("/$getDate/siU", $input, $date, PREG_SET_ORDER)) | ||
AND (preg_match_all("/$getChance/siU", $input, $chance, PREG_SET_ORDER)) | ||
AND (preg_match_all("/$getMyMillion/siU", $input, $myMillion, PREG_SET_ORDER))) : | ||
?> | ||
|
||
<p><i class="fa fa-calendar"></i> <?= utf8_encode($date[0][1]); ?> </p> | ||
|
||
<p> | ||
<span class="btn btn-lg btn-dark rounded"><?= $numbers[0][1]; ?></span> | ||
<span class="btn btn-lg btn-dark rounded"><?= $numbers[1][1]; ?></span> | ||
<span class="btn btn-lg btn-dark rounded"><?= $numbers[2][1]; ?></span> | ||
<span class="btn btn-lg btn-dark rounded"><?= $numbers[3][1]; ?></span> | ||
<span class="btn btn-lg btn-dark rounded"><?= $numbers[4][1]; ?></span> | ||
<span class="btn btn-lg btn-warning rounded"><?= $chance[0][1]; ?></span> | ||
<span class="btn btn-lg btn-warning rounded"><?= $chance[1][1]; ?></span> | ||
</p> | ||
|
||
<h3><small><i class="fa fa-trophy"></i> MY MYLLION</small></h3> | ||
<h3><span class="badge badge-dark"><?= $myMillion[0][1]; ?></span></h3> | ||
<?php endif; ?> | ||
</div> | ||
</section> | ||
|
||
<div class="py-5 bg-light"> | ||
<div class="container"> | ||
<div class="row"> | ||
<div class="col-sm-12"> | ||
<div class="card mb-4 box-shadow"> | ||
<div class="card-header bg-primary text-white text-uppercase"> | ||
Résultats EuroMillions | ||
</div> | ||
<div class="card-body"> | ||
<?php if(preg_match_all("/$getGains/siU", $input, $gains, PREG_SET_ORDER)): ?> | ||
<div class="table-responsive table-striped table-hover"> | ||
<table class="table" cellspacing="0"> | ||
<?= | ||
str_replace( | ||
array( | ||
'<span class="etoile fl sprite-jeux-form_combien_etoile"> </span>', | ||
'<span class="etoile sprite-jeux-form_combien_etoile"> </span>' | ||
), | ||
array( | ||
'<i class="fa fa-star"></i> ', | ||
'<i class="fa fa-star"></i> ' | ||
), | ||
$gains[0][1] | ||
); ?> | ||
</table> | ||
</div> | ||
<?php endif; ?> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</main> | ||
|
||
<?php include ('footer.php'); ?> |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<footer class="text-muted"> | ||
<div class="container"> | ||
<div class="col"> | ||
<p>Scraper gratuit des derniers résultats du Loto et de l'EuroMillions & Loto. Obtenez les derniers résultats de vos jeux d'argent favoris.</p> | ||
<p>Ce site n'est pas affilié à la FDJ (Française des Jeux). Ce script est proposé gratuitement dans un but éducatif.</p> | ||
<p>Je ne suis pas responsables de vos actes !</p> | ||
</div> | ||
<div class="col-12 mt-3"> | ||
<p class="float-left"> | ||
<a href="#">Remonter en haut</a> | ||
</p> | ||
<p class="text-right text-muted">created with <i class="fa fa-heart"></i> by <a href="https://t-php.fr/45-scraper-resultats-loto-euromillions.html"><i>t-php</i></a> | <span>v.1.1.0</span></p> | ||
</div> | ||
</div> | ||
</footer> | ||
|
||
<!-- Jquery 3.2.1 --> | ||
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script> | ||
<!-- Bootstrap 4.0.0 core JavaScript --> | ||
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script> | ||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script> | ||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
<!-- SEO Optimizations --> | ||
<title><?= $seo['title']; ?></title> | ||
<meta name="description" content="<?= $seo['meta_description']; ?>"> | ||
<!-- Favicon --> | ||
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon"> | ||
<link rel="icon" href="favicon.ico" type="image/x-icon"> | ||
<!-- Bootstrap 4.0 CSS --> | ||
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css"> | ||
<!-- Font Awesome 4.7.0 CSS --> | ||
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" type="text/css"> | ||
<!-- Style FDJ Scraper CSS --> | ||
<link rel="stylesheet" href="css/style.css"> | ||
</head> | ||
<body cz-shortcut-listen="true"> | ||
|
||
<header> | ||
<nav class="navbar navbar-expand-md navbar-dark bg-dark"> | ||
<a class="navbar-brand" href="index.php">FDJ PHP SCRAPER</a> | ||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarCollapse" aria-controls="navbarCollapse" aria-expanded="false" aria-label="Toggle navigation"> | ||
<span class="navbar-toggler-icon"></span> | ||
</button> | ||
<div class="collapse navbar-collapse" id="navbarCollapse"> | ||
<ul class="navbar-nav"> | ||
<li class="nav-item active"> | ||
<a class="nav-link" href="index.php">Accueil</a> | ||
</li> | ||
<li class="nav-item"> | ||
<a class="nav-link" href="euromillions.php">Euromillions <span class="sr-only">(current)</span></a> | ||
</li> | ||
<li class="nav-item"> | ||
<a class="nav-link" href="loto.php">Loto</a> | ||
</li> | ||
</ul> | ||
|
||
</div> | ||
</nav> | ||
</header> |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,78 +1,55 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
<title>FDJ Scraper / Euromillions & Loto Scraper</title> | ||
<?php | ||
//SEO | ||
$seo['title'] = "Euromillions & Loto PHP Scraper"; | ||
$seo['meta_description'] = ""; | ||
//Include Header Page | ||
include ('header.php'); | ||
?> | ||
|
||
<!-- Bootstrap --> | ||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"> | ||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous"> | ||
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries --> | ||
<!-- WARNING: Respond.js doesn't work if you view the page via file:// --> | ||
<!--[if lt IE 9]> | ||
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script> | ||
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> | ||
<![endif]--> | ||
</head> | ||
<body cz-shortcut-listen="true"> | ||
<!-- Navbar --> | ||
<nav class="navbar navbar-inverse"> | ||
<div class="container"> | ||
<div class="navbar-header"> | ||
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar"> | ||
<span class="sr-only">Toggle navigation</span> | ||
<span class="icon-bar"></span> | ||
<span class="icon-bar"></span> | ||
<span class="icon-bar"></span> | ||
</button> | ||
<a class="navbar-brand" href="#">FDJ PHP SCRAPER</a> | ||
</div> | ||
<div id="navbar" class="navbar-collapse collapse"> | ||
<ul class="nav navbar-nav"> | ||
<li class="active"><a href="#">Home</a></li> | ||
</ul> | ||
<main role="main"> | ||
<section class="jumbotron text-center"> | ||
<div class="container-fluid"> | ||
<h1 class="jumbotron-heading">SCRAPER PHP EUROMILLIONS & LOTO</h1> | ||
<p class="text-muted">Exemple PHP pour scraper les derniers résultats EuroMillions & Lotos.</p> | ||
</div> | ||
</div> | ||
</nav> | ||
</section> | ||
|
||
<div class="container theme-showcase" role="main"> | ||
<div class="well"> | ||
<h1>PHP EUROMILLIONS & LOTO SCRAPER</h1> | ||
<div class="alert alert-info"> | ||
<p><strong>EN : </strong>PHP example to scrap Euromillions numbers.</p> | ||
<p><strong>FR : </strong>Exemple PHP permettant de récupérer les résultats Euromillions via le site de la FDJ</p> | ||
</div> | ||
<div class="text-center"> | ||
<button id="btn_euromillions" type="button" class="btn btn-lg btn-success text-uppercase">View Euromillions Results</button> | ||
<button id="btn_loto" type="button" class="btn btn-lg btn-success text-uppercase">View Loto Results</button> | ||
<div class="py-5 bg-light"> | ||
<div class="container"> | ||
<div class="row"> | ||
<div class="col-sm-12 col-md-4"> | ||
<div class="card mb-4 box-shadow"> | ||
<img class="card-img-top" data-src="" alt="Euromillions Scraper PHP" src="img/euromillions.png" data-holder-rendered="true" style="height: 225px; width: 100%; display: block;"> | ||
<div class="card-body text-center"> | ||
<h4>Euromillions</h4> | ||
<p class="card-text">Découvrez les derniers résultats du tirage Euromillions.</p> | ||
<a href="euromillions.php" class="btn btn-primary text-uppercase">Voir les résultats EuroMillions</a> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="col-sm-12 col-md-4"> | ||
<div class="card mb-4 box-shadow"> | ||
<img class="card-img-top" data-src="" alt="Loto Scraper PHP" src="img/loto.png" data-holder-rendered="true" style="height: 225px; width: 100%; display: block;"> | ||
<div class="card-body text-center"> | ||
<h4>Loto</h4> | ||
<p class="card-text">Découvrez les derniers résultats du tirage du Loto.</p> | ||
<a href="loto.php" class="btn btn-primary text-uppercase">Voir les résultats du Loto</a> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="col-md-4"> | ||
<div class="card mb-4 box-shadow"> | ||
<img class="card-img-top" data-src="holder.js/100px225?theme=thumb&bg=55595c&fg=eceeef&text=Thumbnail" alt="Thumbnail [100%x225]" src="data:image/svg+xml;charset=UTF-8,%3Csvg%20width%3D%22348%22%20height%3D%22225%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20348%20225%22%20preserveAspectRatio%3D%22none%22%3E%3Cdefs%3E%3Cstyle%20type%3D%22text%2Fcss%22%3E%23holder_1613ad5f2b1%20text%20%7B%20fill%3A%23eceeef%3Bfont-weight%3Abold%3Bfont-family%3AArial%2C%20Helvetica%2C%20Open%20Sans%2C%20sans-serif%2C%20monospace%3Bfont-size%3A17pt%20%7D%20%3C%2Fstyle%3E%3C%2Fdefs%3E%3Cg%20id%3D%22holder_1613ad5f2b1%22%3E%3Crect%20width%3D%22348%22%20height%3D%22225%22%20fill%3D%22%2355595c%22%3E%3C%2Frect%3E%3Cg%3E%3Ctext%20x%3D%22116.234375%22%20y%3D%22120.3%22%3EThumbnail%3C%2Ftext%3E%3C%2Fg%3E%3C%2Fg%3E%3C%2Fsvg%3E" data-holder-rendered="true" style="height: 225px; width: 100%; display: block;"> | ||
<div class="card-body text-center"> | ||
<h4>Prochainement</h4> | ||
<p class="card-text">..........................................................................................................................................................</p> | ||
<a href="" class="btn btn-secondary text-uppercase btn-disable">Prochainement...</a> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
<p class="alert text-right">Javascript must be enabled to use this demonstration</p> | ||
</div> | ||
<div class="row"> | ||
<div class="col-xs-12 col-md-6" id="content-euromillions"></div> | ||
<div class="col-xs-12 col-md-6" id="content-loto"></div> | ||
</div> | ||
</div> <!-- /container --> | ||
</div> | ||
</main> | ||
|
||
<!-- Bootstrap core JavaScript --> | ||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script> | ||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script> | ||
<script type="text/javascript"> | ||
$( document ).ready(function() { | ||
$( "#btn_euromillions" ).click(function() { | ||
$( "#content-euromillions" ).load( "scrap-euromillions.php" ); | ||
}); | ||
$( "#btn_loto" ).click(function() { | ||
$( "#content-loto" ).load( "scrap-loto.php" ); | ||
}); | ||
}); | ||
</script> | ||
</body> | ||
</html> | ||
<?php include ('footer.php'); ?> |
Oops, something went wrong.