Occurence php

Fermé
layeures Messages postés 286 Date d'inscription mercredi 13 juin 2007 Statut Membre Dernière intervention 22 juin 2018 - 26 déc. 2009 à 11:48
layeures Messages postés 286 Date d'inscription mercredi 13 juin 2007 Statut Membre Dernière intervention 22 juin 2018 - 26 déc. 2009 à 13:41
Bonjour,

mon script ne marche pas le probleme vien de la recuperation de l'occurence d une adresse web

$sourcea = strstr ($sourcea, "href=\"http://(a-z)"); //on cherche http ...

pouvez m aidez a resoudre ce probleme merci.

1 réponse

layeures Messages postés 286 Date d'inscription mercredi 13 juin 2007 Statut Membre Dernière intervention 22 juin 2018 3
26 déc. 2009 à 13:41
aidez moi si vous plait

voici le code
<?php

//$mot = "emploi";
// par defaut : $url = "http://www.lycos.fr/?query=".$mot."&page2=".$nb;
//https://fr.search.yahoo.com/search?p=dede&ei=UTF-8&rd=r1&fr=yfp-t-703&xargs=0&pstart=1&b=11
//http://recherche.netscape.fr/...
$url = "https://www.google.fr/search?hl=fr&rlz=1R2SUNC_frFR356&q=dede&start=10&sa=N&gws_rd=ssl";
$ada = fopen ($url, "r");
$file = file ($url);
$source = "";
while (!feof($ada)){
$source .= fgets ($ada, 1024);
}

$i =0;
$d = count($file);

while ($i <$d){


$sourcea = $source;

$sourcea = strstr($sourcea, "href=\"http://"); //on cherche http ...

//**http%3a//
$var_string_exp = explode("\"",$sourcea);

$var_string_exp2 = array_slice($var_string_exp, 0,2);

$sourcea = implode("\"",$var_string_exp2);

$source = str_replace ($sourcea,"888",$source);
$sourcea = str_replace ("href=\"","",$sourcea);
echo $sourcea."<br />";
if ($sourcea !== ""){

//echo "<iframe src=\"test2 simple.php?url=".$sourcea."\" width=100%></iframe>";

}

$i++;
}

//}



?>
0