<?php
if (isset($_POST['ind'])) {
$ind = $_POST['ind']; // récupération de la valeur envoyée
include("/home/.../pwa.php");
}
?>
<?php
echo $ind; // afficher la valeur de $_POST['ind']
// ou
// if (isset($ind)) {
// echo $ind;
// }
?>
<?php
/******************/
/** load.php **/
/******************/
$array_files = array();
$i = 0;
const FILES = 0;
const ID = 1;
foreach($_GET as $key => $value) {
/*************************/
/** ID LAST CHILD **/
/*************************/
$array_files[$i][ID] = $key;
/*************************/
/** URL FICHIER **/
/*************************/
$array_files[$i][FILES] = $value;
$i++;
}
$i_max = $i;
echo "<script>\n";
echo " var urls = [];\n";
echo " var obj_id = new Object();\n";
echo " var i = 0;\n";
for($i = 0; $i < $i_max; $i++) {
echo " urls[i] = " . $array_files[$i][FILES] . ";\n";
echo " obj_id.urls[i] = " . $array_files[$i][ID] . "};\n";
echo " i++;\n";
}
echo " var i_max = i;\n";
echo " var obj_result = new Object();\n";
echo " var head = null;\n";
echo " var ROOT = null;\n";
echo " var id = null;\n";
echo " var url = null;\n";
echo " var resp = null;\n";
echo " var url = null;\n";
echo " var result = null;\n";
echo " Promise.all(urls.map(url => fetch(url)))\n";
echo " .then(resp => Promise.all( resp.map(r => r.text()) ))\n";
echo " .then(result => {\n";
echo " obj_result.url = result;\n";
echo " });\n";
echo "\n";
echo " for(i = 0; i < i_max; i++) {\n";
echo "\n";
echo " url = urls[i];\n";
echo " result = obj_result.url;\n";
echo "\n";
echo " head = JSON.parse(result);\n";
echo " if(id !== null) {\n";
echo " getElementById(id).appendChild(head);\n";
echo " } else {\n";
echo " ROOT = head;\n";
echo " }\n";
echo "\n";
echo " id = obj_id.url;\n";
echo " }\n";
echo "\n";
echo "</script>\n";
?>
<?php
// ...
?>
<script>
/* */
</script>
➡️ Offre MyRankingMetrics ⬅️
pré-audit SEO gratuit avec RM Tech (+ avis d'expert)
coaching offert aux clients (avec Olivier Duffez ou Fabien Faceries)
Voir les détails ici