Occurence php

layeures Messages postés 310 Statut Membre -  
layeures Messages postés 310 Statut Membre -
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.
Configuration: Windows XP Internet Explorer 7.0

1 réponse

  1. layeures Messages postés 310 Statut Membre 3
     
    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