Post
#1
|
|
|
Grupa: Zarejestrowani Postów: 7 Pomógł: 0 Dołączył: 2.08.2005 Ostrzeżenie: (0%)
|
Witam,
Moglby ktos podrzucic fragment skryptu php ktory wycigalby wszystkie urle (nie mowie tylko o linkach w <a> ) z danej zmiennej? Probowalem bawic sie z preg_match_all ale nie bylem w stanie napisac zadnej odpowiedniej regulki (IMG:http://forum.php.pl/style_emoticons/default/sad.gif) Z gory dzieki za wszelkiego rodzaju sugestie. Pozdrawiam, Marcin |
|
|
|
![]() |
Post
#2
|
|
|
Grupa: Zarejestrowani Postów: 7 Pomógł: 0 Dołączył: 2.08.2005 Ostrzeżenie: (0%)
|
Przejrzelem juz wczesniej. narazie mam 2 takie fragmenty kodu ale zadnen nie zwraca tego co powinien:
Kod $html='aaaaaaa http://to.jest.adres.com/test.html?zmienna=1 aaaaaaa'; preg_match_all("/(http[s]?):\/\/{1}([\w\.-]+)\.(\w{2,6}){1}/", $html, $matches); print_r($matches); preg_match_all('/(http|https):\/\/([^:\/\s]+)((\/\w+)*)(([\w\-\.]+\.[^#?\s]+)(.*?)(#[\w\-]+)?)?/',$html,$matches); print_r($matches); Zwraca: Kod Array
( [0] => Array ( [0] => http://to.jest.adres.com ) [1] => Array ( [0] => http ) [2] => Array ( [0] => to.jest.adres ) [3] => Array ( [0] => com ) ) Array ( [0] => Array ( [0] => http://to.jest.adres.com/test ) [1] => Array ( [0] => http ) [2] => Array ( [0] => to.jest.adres.com ) [3] => Array ( [0] => /test ) [4] => Array ( [0] => /test ) [5] => Array ( [0] => ) [6] => Array ( [0] => ) [7] => Array ( [0] => ) [8] => Array ( [0] => ) ) |
|
|
|
tnkywe [regexp]Wyciaganie URLi 13.07.2006, 20:09:35
treewood nie wiem czy to to co ci trzeba ale przyjzyj sie l... 13.07.2006, 21:55:20
siemakuba Kod$html=' aaaaaaa http://to.jest.adr... 14.07.2006, 01:05:22 ![]() ![]() |
|
Aktualny czas: 28.12.2025 - 10:54 |