إقتباس :يمكن المشكل من الويندوز نفسه انا استعمل ويندوز 10
أكيد أخى المشكل من الويندوز نفسه لكن والله شغالة معايا زى الفل بفضل الله
على ويندوز 8 و 7
أو يمكنك تجربة هذا الكود كاملا
PHP كود :
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim page As String = "https://www.facebook.com/"
Dim SourcePage As Text.StringBuilder = GetSourcePage(New Uri(page))
If SourcePage IsNot Nothing Then
Dim ID As String = GetID(SourcePage)
MsgBox(If(ID Is Nothing, "Fail :(", "Success id:= " & ID))
Else
MsgBox("page source is empty :(")
End If
End Sub
Private Function GetID(ByVal SourcePage As Text.StringBuilder) As String
Dim regex As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(?<=entity_id=)(.*?)(?=&)")
Dim match As System.Text.RegularExpressions.Match = regex.Match(SourcePage.ToString)
Dim ID As String = Nothing
If match.Success Then
For Each item In match.Groups
'MsgBox(item.Value)
ID = CStr(item.Value)
Exit For
Next
End If
Return ID
End Function
Private Function GetSourcePage(ByVal url As Uri) As Text.StringBuilder
Dim SB As New Text.StringBuilder
Dim Request As Net.HttpWebRequest
Dim Response As Net.HttpWebResponse
Dim Reader As IO.StreamReader
Try
Request = Net.HttpWebRequest.Create(url)
Request.UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.72 Safari/537.36"
Request.AllowAutoRedirect = True
Request.ContentType = "application/x-www-form-urlencoded"
Response = Request.GetResponse
Reader = New IO.StreamReader(Response.GetResponseStream())
SB.Append(Reader.ReadToEnd)
Catch ex As Exception
SB = Nothing
End Try
Return SB
End Function

