Visualizzazione dei risultati da 1 a 3 su 3

Discussione: Reg Ex url img

  1. #1
    Utente di HTML.it
    Registrato dal
    Oct 2006
    Messaggi
    47

    Reg Ex url img

    Ciao,
    sto cercando di creare una reg ex per ottenere l'url delle img in una pagina
    ma non ci riesco

    questo il codice che ho scritto, potete darmi una mano?
    Codice PHP:
    preg_match_all('/<IMG([]*)SRC=([\"]*){0,1}(.+)([\"]{0,1}) >/i'$page_contents$match_arrayPREG_SET_ORDER);


        foreach (
    $match_array as $entry) {
            
    $src $entry[2];
            echo 
    "[b]img src[/b]: $src;";
        } 
    Grazie

    Giuseppe

  2. #2
    Prendila con le molle

    $html = file_get_contents('http://www.html.it');
    preg_match_all('#<img[^>]*src="([^"]*)"[^>]*>#i', $html, $matches);
    var_dump($matches[1]);
    se sei su php5 ti conviene usare le DOM functions.


    Without faith, nothing is possible. With it, nothing is impossible
    http://ilwebdifabio.it

  3. #3
    Utente di HTML.it
    Registrato dal
    Oct 2006
    Messaggi
    47
    sto usando php4.
    In alternativa sapete se posso usare le dom functions in JS e passare il risultato a php?

    Grazie

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.