<?php
function poisk($x = null, $index = null){
$content = zapros('тут url');
preg_match_all('/<div class="post_line lin(.*?)\>/s', $content, $str);
$y = 1;
while($y <= $x){
preg_match('/data-type="(.*?)\_/', $str[1][$y], $type);
if($index == 1){
switch($type[1]){
case 'posts':{
preg_match('/line post(.*?)\"/', $str[1][$y], $id);
$result = $id[1];
break;
}
}
$y++;
}else{
switch($type[1]){
case 'posts':{
preg_match('/line post(.*?)\"/', $str[1][$y], $id);
$result = $id[1];
break;
}
case 'blogs':{
preg_match('/line post(.*?)\"/', $str[1][$y], $id);
$result = $id[1];
break;
}
}
$y++;
}
echo $id[1].' '.$result.'<br />';
}
}
poisk(4, 1);
?>
<div style="display: none">
<div class="post_line line post405462" data-type="blogs_type">
<div class="w60 left align-center">
405462 </div>
<div class="w300 left">
<span class="project_name">Новости</span>
</div>
<div class="w150 left">
<a class="button projectDetails" data-id="405462" data-href="" href="javascript:void(0);">Посмотреть новость</a>
</div>
<div class="w150 right align-center">
<a href="javascript:" id="405462" title="Оставить отзыв" class="tipsy_class bother_project"></a>
<a href="javascript:" data-id="405462" title="Поставить оценку" class="tipsy_class delete_project"></a>
</div>
<div class="clear"></div><!-- /clear -->
</div>
</div>
<div style="display: none">
<div class="post_line line post405463" data-type="posts_type">
<div class="w60 left align-center">
405463 </div>
<div class="w300 left">
<span class="project_name">Новости</span>
</div>
<div class="w150 left">
<a class="button projectDetails" data-id="405463" data-href="" href="javascript:void(0);">Посмотреть новость</a>
</div>
<div class="w150 right align-center">
<a href="javascript:" id="405463" title="Оставить отзыв" class="tipsy_class bother_project"></a>
<a href="javascript:" data-id="405463" title="Поставить оценку" class="tipsy_class delete_project"></a>
</div>
<div class="clear"></div><!-- /clear -->
</div>
</div>