Bonjour,
Je voudrais utiliser un widget d'un site, pour qu'il fonctionne je dois lui transmettre les noms des joueurs a la place de nickJoueur.
Pour la div : camyptr_widget_ce pas de problème.
Cependant comment ajouter le nom dans le lien javaScript (nickJoueur).

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
<script type="text/javascript" src="http://www.pokertableratings.com/js/widgets/widget.js?1247"></script>
<script type="text/javascript">if (ptrwidgets) ptrwidgets.load('ccaebc98452b4f1973f2b2d7a0842e7f','nickJoueur','fulltilt');</script>
 
<div id="camyptr_widget_ce">Check out the full <a href="http://www.pokertableratings.com/fulltilt-player-search/nickJoueur">Nickjoueur Online Poker Profile</a> and the best <a href="http://www.pokertableratings.com/tools">free online poker tools</a> at <a href="http://www.pokertableratings.com">PokerTableRatings</a>!</div>
Je récupère des noms de joueur dans un fichier texte, dans ma boucle foreach($resultat['nom'] as $elt), j'affiche la div du widget + le nom du joueur pour compléter le lien.

Voici mon code :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?php
error_reporting(0);
if($_GET['id'])
{
	$url= $_GET['id'];
	$contenuTxt = fopen($url, 'r');	
	$f = file($url); // on transforme le fichier en tableau
	 /* on recherche toutes les occurrences de "Full Tilt Poker Game" qui identifie toutes les nouvelles sections
	preg_grep renvoie un tableau indexé array( positionDansTableauOriginal , ligneMatchantPattern )
	*/
	$ar = preg_grep('`Full Tilt Poker Game`' , $f );
	end( $ar ); // on positionne le pointeur du tableau de résultats sur la dernière occurrence trouvée 
	$derniereSection = key( $ar ); // on récupère la clé du dernier résultat
	$monTab = array_slice( $f , $derniereSection , 10 ); // on récupère 10 lignes dans le tableau original depuis la clé derniereSection 
	//print_r( $monTab );
 
 
	$stringTxt = implode("|", $monTab); // Explose le tableau en chaine de caractère
	$stringTxt = utf8_encode(strip_tags($stringTxt)); // encodage utf8 + nettoyage espace
	$stringTxt = str_replace(' ','',$stringTxt);
 
	$reg="#Seat\d+:(?P<nom>[^(]+)#";
	preg_match_all($reg, $stringTxt, $resultat);
 
	$tabUrl[] = explode('\\',$url);
	$utilisateur = $tabUrl[0][4];
 
	// Effacer le nom de l'utilisateur du tableau
    unset($resultat['nom'][array_search($utilisateur, $resultat['nom'])]);
 
	foreach($resultat['nom'] as $elt)
	{ 
		echo '<div id="myptr_widget_ccae">Check out the full <a href="http://www.pokertableratings.com/fulltilt-player-search/'.$elt.'">'.$elt.' Online Poker Profile</a> and the best <a href="http://www.pokertableratings.com/tools">free online poker tools</a> at <a href="http://www.pokertableratings.com">PokerTableRatings</a>!</div>';
	}
 
}
else
{
	header("Location: index.php");	
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
 
<script type="text/javascript" src="http://www.pokertableratings.com/js/widgets/widget.js?1243"></script>
<script type="text/javascript">if (ptrwidgets) ptrwidgets.load('ccaebc98452b4f1973f2b2d7a0842e7f','Nom du joueur','fulltilt');</script>
 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="css/popup.css" rel="stylesheet" type="text/css" media="screen" />
<title>FullTilt Fish Tracker</title>
</head>
<body>
<img style="margin-left:15px; margin-bottom:15px" src="img/donkey.jpg" width="60" height="60" alt="donkey" />
</body>
</html>

Est-ce possible de changer le nom et d'afficher toutes mes DIV dans une seule page ou je dois utiliser des frames :S, je ne vois pas comment utiliser ma boucle.