Visa ett inlägg
Oläst 2009-10-08, 17:16 #6
Clarence Clarence är inte uppkopplad
Administratör
 
Reg.datum: Jan 2003
Inlägg: 1 974
Clarence Clarence är inte uppkopplad
Administratör
 
Reg.datum: Jan 2003
Inlägg: 1 974
Citat:
Ursprungligen postat av Lando Visa inlägg
Funkar inte alls. Kolla:

http://lando.se/c.php

//Kod

$text = file_get_contents("http://www.youtube.com");

preg_match_all('#<a[^>]* href="([^"]+)"[^>]*>([\w\W]+)</a>#i', $text, $matches);

header("Content-type: text/plain");
print_r($matches);
Blev visst lite sent för regexp Lägg till U modifiern så funkar den. Alltså:
Kod:
preg_match_all('#<a[^>]* href="([^"]+)"[^>]*>([\w\W]+)</a>#Ui', $text, $matches);
Notera dock att denna tar vilken text som helst i href, inte bara http-adresser
Clarence är inte uppkopplad   Svara med citatSvara med citat