Dim s As Integer, e As Integer s = InStr(1, Text1.Text, "www.") s = s + 4 e = InStr(1, Text1.Text, ".blogfa") Text2.Text = Mid(Text1.Text, s, e - s)
برای اینکه روال کار دستتون بیاد، یکی از وبلاگ های مثلا سایت پرشین بلاگ رو ذخیره کنید و با یه ویرایشگر باز کنید.
به تگ های موجود در اون دقت کنید و ببینید تگ اصلی که پست ها رو در برمی گیره چیه.
هر پستی بالاش دو تا کد قرار داره، که اولی blogID و دومی postID هست.
<a title="Comments" onclick="s_comment(134384,2583197)" href="javascript:void(0)"> <img src="%DA%A9%D9%85%D9%88%D9%86_files/comment.gif" alt="Comments" width="16" height="16"> پیام های دیگران (<script language="javascript" type="text/javascript">document.write(get_cc(2583197))</script>1) </a>
برای پیدا کردن آخرین پست، از آخر جستجو کنید و اولین پست ( از آخر) رو پیدا کنید.
حالا به لینک نظرات دقت کنید. برای نمونه:
http://comments.persianblog.ir/?blogID=134384&postID=2583197&blogName=viraso
کافیه اعداد بدست اومده از مرحله قبل رو در آدرس بالا جایگذاری کنید تا لینک نظراتش بدست بیاد.
خب حالا سورس صفحه نظرات رو (html) بدست بیارید و غالبش رو بررسی کنید.
با کمی دقت به فرمتی که هر نظر داره، آشنا می شید.
حالا با کمی پردازش رشته می تونید نظرات و همه اطلاعات مربوط به اون رو استخراج کنید.
برای دسترسی به سورس هر صفحه از کد زیر استفاده کنید:
Dim sTextHTML As String sTextHTML = WebBrowser1.Document.documentElement.outerHTML
لیست وبلاگ های سایت هایی مثل بلاگفا و پرشین بلاگ رو می تونید با استفاده از کنترل Web Browser و با کد زیر بدست بیارید:
Private Sub Command1_Click() Dim i As Integer Dim str As String List1.Clear For i = 0 To WebBrowser1.Document.links.length - 1 str = WebBrowser1.Document.links.Item(i) If Left$(LCase(str), 4) = "http" And InStr(1, LCase(str), ".persianblog.ir") > 0 Then List1.AddItem (WebBrowser1.Document.links.Item(i)) End If Next i MsgBox "Process Completed" End Sub
آدرس لیست وبلاگ های سایت پرشین بلاگ:
http://persianblog.ir/weblogs.aspx
در صورتی که صفحه موردنظر از تکنولوژی پویا استفاده کنه روش بالا جواب نمیده
Private Sub Command1_Click() Dim i As Long Dim j As Long With List1 For i = 0 To .ListCount - 1 For j = .ListCount To (i + 1) Step -1 If .List(j) = .List(i) Then .RemoveItem j End If Next Next End With End Sub Private Sub Form_Load() For i = 1 To 10 List1.AddItem "item " & i List1.AddItem "item " & i + 1 Next End Sub
require_once ROOT_DIR.'/engine/init.php';
require_once ROOT_DIR.'/engine/modules/rand_news.php';
$tpl->set('{info}', "<span id='dle-info'>".$tpl->result['info']."</span>");
$tpl-> set ('{rand_news}', $rand_news);
[group=5] <form method="post" name="registration" id="registration" action="?do=register"> Username: <br> <input type="text" name="name" id='name' style="width:108; height:21" class="f_input" /> <BR> <input style="height:18px; font-family:tahoma; font-size:11px; border:1px solid #DFDFDF; background: #FFFFFF" title="Checking Availablity" onclick="CheckLogin(); return false;" type="button" value="Check Name" /><div id='result-registration'></div> <BR> Password: <BR> <input type="password" name="password1" class="f_input" /> <BR> Confirm Password: <BR> <input type="password" name="password2" class="f_input" /> <BR> <BR> E-Mail:<BR> <input type="text" name="email" class="f_input" /> <BR> Safety Code: <BR> <img src="/engine/modules/antibot.php" alt="Please Write This Code in The Box Below" border="0"> <BR> Enter Here: <BR> <input type="text" name="sec_code" style="width:115px" class="f_input" /> <BR> <input type="image" style="width:80px; height:20px" src="/templates/Default/images/dlet_bttn_submit.gif" name="submit" alt="Submit" /> <input name="submit_reg" type="hidden" id="submit_reg" value="submit_reg"> </form> [/group]
$tpl->set('{topnews}',$topnews);
$tpl->set('{dle_img}',$dle_img);
require_once ENGINE_DIR.'/modules/calendar.php';
require_once ENGINE_DIR.'/modules/dle_img.php';
require_once ROOT_DIR.'/engine/init.php';
require_once ROOT_DIR.'/engine/modules/treemenu.php';
$tpl->set('{login}',$login_panel);
$tpl->set('{treemenu}', $treemenu); $tpl->set('{title}', $title_tag);
{pogoda_almaty}
if($titl_e) $metatags['title'] = $titl_e.' » '.$config['home_title'];
include_once ENGINE_DIR."/modules/pogoda_almaty.php";
$tpl->set('{info}',$tpl->result['info']);
$tpl->set('{pogoda_almaty}', $pogoda_almaty);
$text = file_get_contents("http://informer.gismeteo.ru/xml/36870_1.xml");
require_once ROOT_DIR.'/engine/init.php';
require_once ROOT_DIR.'/engine/modules/linklogo.php';
$tpl->load_template('main.tpl');
'editnews' => 'user',
'linklogo' => 'admin',
$options['others'] = array(
array( 'name' => "لوگوی دوستان", 'url' => "$PHP_SELF?mod=linklogo", 'descr' => "اضافه , حذف و ویرایش کردن لوگوی دوستان", 'image' => "linklogo.png", 'access' => "1", ),