Форум: Форум PHPФорум ApacheФорум Регулярные ВыраженияФорум MySQLHTML+CSS+JavaScriptФорум FlashРазное
Новые темы: 0000000
PHP. Практика создания Web-сайтов (второе издание). Авторы: Кузнецов М.В., Симдянов И.В. Самоучитель MySQL 5. Авторы: Кузнецов М.В., Симдянов И.В. Самоучитель PHP 5 / 6 (3 издание). Авторы: Кузнецов М.В., Симдянов И.В. PHP 5/6. В подлиннике. Авторы: Кузнецов М.В., Симдянов И.В. MySQL 5. В подлиннике. Авторы: Кузнецов М.В., Симдянов И.В.
ВСЕ НАШИ КНИГИ
Консультационный центр SoftTime

Форум Регулярные Выражения

Выбрать другой форум

 

Здравствуйте, Посетитель!

вид форума:
Линейный форум (новые сообщения вниз) Структурный форум

тема: Помогите с Яхо

Сообщения:  [1-10]   [11-19] 

 
 автор: lino   (07.09.2006 в 22:03)   письмо автору
 
   для: Snorri   (05.09.2006 в 23:41)
 

Да -сейчас верно...
ОНО!
Спасибо большое!

   
 
 автор: Snorri   (05.09.2006 в 23:41)   письмо автору
 
   для: lino   (05.09.2006 в 12:32)
 

Делаю

<?
$text
=file_get_contents("http://dir.yahoo.com/Government/Web_Directories/");
$ptn="#<li><a.*?>([^<]+)<\/a>\s*<br />(.*?)<br />\s*<font color=\"green\">(.*?)<\/font>\s*<\/li>#is";
preg_match_all($ptn,$text,$out);
print_r($out);
?>

Получаю

[1] => Array
        (
            [0] => Munisource.org
            [1] => Governments on the WWW
            [2] => PARLINE Database
            [3] => World World
            [4] => Regional Councils of Government
            [5] => AdmiNet: World Governments
            [6] => Political Court
            [7] => Administracions a la Internet
            [8] => GovBrowser.com
        )

    [2] => Array
        (
            [0] => 
Search for cities, towns, and municipal web sites world wide. Includes links to education, associations, and other resources.
            [1] => 
Comprehensive database of governmental institutions and political parties that have web sites.
            [2] => 
Provides brief descriptions of, and links to, parliaments around the world. From the Inter-Parliamentary Union.
            [3] => 
An icon-based index of relevant links to world governments, world news and hundreds of information wells worldwide.
            [4] => 
Comprehensive list of both United States and world councils of government, regional commissions, metropolitan planning organizations, regional governments, and agencies.
            [5] => 
Includes links to official sites and other resources for world governments.
            [6] => 
Offers a brief overview of the various forms of government seen throughout the world in the past and present.
            [7] => 
Links to government Web sites worldwide with an emphasis on Catalan and Spanish sites.
            [8] => 
Directory of federal, state, local, and tribal government web sites.
        )

    [3] => Array
        (
            [0] => www.munisource.org
            [1] => www.gksoft.com/govt
            [2] => www.ipu.org/parline-e/parlinesearch.asp
            [3] => www.worldworld.com
            [4] => www.abag.ca.gov/abag/other_gov/rcg.html
            [5] => www.adminet.com/world/gov
            [6] => www.political-court.com
            [7] => www.blues.uab.es/mgp/governs
            [8] => www.govbrowser.com
        )

оно или нет?

   
 
 автор: lino   (05.09.2006 в 12:32)   письмо автору
 
   для: cheops   (04.09.2006 в 22:43)
 

На странице 10 ссылок -а выдается в массиве только 5....
И потом смотрите-
Вот для одной ссылки все 3 значения из масивов-Название, описание, ссылка...
[2] => Governments on the WWW
[2] => <br />
Provides brief descriptions of, and links to, parliaments around the world. From the Inter-Parliamentary Union.<br />
[2] => www.ipu.org/parline-e/parlinesearch.asp

А на самом деле на странице мы видим
2-я ссылка
Governments on the WWW - название
Comprehensive database of governmental institutions and political parties that have web sites.-описание
www.gksoft.com/govt - это URL
Описание и URL в результате работы скрипта взяты из нижележащей ссылки-

PARLINE Database
Provides brief descriptions of, and links to, parliaments around the world. From the Inter-Parliamentary Union.
www.ipu.org/parline-e/parlinesearch.asp

И так во многих местах все перепутано. Посмотрите пожалуйста -надо сравнить оригинал страницы и то-что выводит скрипт.

   
 
 автор: cheops   (04.09.2006 в 22:43)   письмо автору
 
   для: lino   (04.09.2006 в 21:32)
 

Последнее выражение у меня выдало текст
<pre>Array
(
    [1] => Array
        (
            [0] => <b>Politics@</b>
            [1] => Rulers
            [2] => Governments on the WWW
            [3] => World World
            [4] => AdmiNet: World Governments
            [5] => Administracions a la Internet
        )

    [2] => Array
        (
            [0] => 
&nbsp;&nbsp;&nbsp;&nbsp;(<a href=http://us.rd.yahoo.com/dir/catpg/help/*http://help.yahoo.com/help/us/dir/basics/basics-21.html>What's This?</a>)</small></span><div class=cnt>Sites <b>1 - 10</b> of <b>10</b></div>
</td></tr>
<tr valign=top><td colspan=2><hr noshade></td></tr>
<tr><td height=1><spacer type="block" width="1" height="1"></td></tr>
<tr><td><div class=st><ul>
<li><a href=http://www.munisource.org/>Munisource.org</a>
<br />
Search for cities, towns, and municipal web sites world wide. Includes links to education, associations, and other resources.<br />

            [1] => ]</font>
<br />
Features a list of rulers and heads of states for all countries dating back to 1700.<br />

            [2] => 
<br />
Provides brief descriptions of, and links to, parliaments around the world. From the Inter-Parliamentary Union.<br />

            [3] => 
<br />
Comprehensive list of both United States and world councils of government, regional commissions, metropolitan planning organizations, regional governments, and agencies.<br />

            [4] => 
<br />
Offers a brief overview of the various forms of government seen throughout the world in the past and present.<br />

            [5] => 
<br />
Directory of federal, state, local, and tribal government web sites.<br />

        )

    [3] => Array
        (
            [0] => www.munisource.org
            [1] => www.rulers.org
            [2] => www.ipu.org/parline-e/parlinesearch.asp
            [3] => www.abag.ca.gov/abag/other_gov/rcg.html
            [4] => www.political-court.com
            [5] => www.govbrowser.com
        )

)
</pre>

Какую ссылку вы хотите исключить?

   
 
 автор: lino   (04.09.2006 в 21:32)   письмо автору
 
   для: lino   (04.09.2006 в 09:39)
 

ссылка есть, жду Вашего совета...

   
 
 автор: lino   (04.09.2006 в 09:39)   письмо автору
 
   для: cheops   (02.09.2006 в 22:35)
 

Вот
http://dir.yahoo.com/Government/Web_Directories/

   
 
 автор: cheops   (02.09.2006 в 22:35)   письмо автору
 
   для: lino   (02.09.2006 в 21:13)
 

Приведите ссылку на страницу, где происходит сбой.

   
 
 автор: lino   (02.09.2006 в 21:13)   письмо автору
 
   для: lino   (02.09.2006 в 21:08)
 

Но скрипт парсинга Яхо перестал работать...Видимо-они что-то изменили в выдаче.
Выдает и перемешивает сами ссылки и названия....То есть берет 1-м элементом массива - одно название, а описание из элемента -другого....
Очень нужно поправить код для Яхи....

если у кого есть скрипт - выбирающий ссылки с названиями и описаниями из Яхи, или других каталогов зарубежных -помогите очень нужно!
Для всех-кроме dmoz...
Не работает вышеприведенный скрипт...

   
 
 автор: lino   (02.09.2006 в 21:08)   письмо автору
 
   для: lino   (28.08.2006 в 09:43)
 

разобрался...

   
 
 автор: lino   (28.08.2006 в 09:43)   письмо автору
 
   для: lino   (25.08.2006 в 15:44)
 

Тут возникла проблемка....
Все хорошо работает -только в описаниях ссылок лишние теги....
Вот такие -как их убрать в каждом из описаний?
пример описания-
<a href=http://www.cutecats.com/ target=_blank></a>
<br />
Photo galleries and tidbits of kitty information where users can post their favorite cat albums.<br />

Как убрать все теги - кроме текста?
То есть нужно убрать
<a href=http://www.cutecats.com/ target=_blank></a>
<br />

и в конце <br />

   

Сообщения:  [1-10]   [11-19] 

Форум разработан IT-студией SoftTime
Rambler's Top100
вверх

Rambler's Top100 Яндекс.Метрика Яндекс цитирования