المشاركات : 340
المواضيع 119
الإنتساب : Jul 2013
السمعة :
6
الشكر: 599
تم شكره 466 مرات في 66 مشاركات
04-07-16, 02:56 AM
(آخر تعديل لهذه المشاركة : 04-07-16, 05:23 AM {2} بواسطة أسامة.)
(04-07-16, 02:44 AM)سعود كتب : قلت لك فيه مشكلة واظنها تخص الحماية اما تحديد الطلب او غيرها جرب خذ رابط صورة واسندها لمربع صورة عبر خاصية Load
يعني
PHP كود :
pic.load("كامل رابط الصورة اللي بالموقع وشوف ايش اللي يصير")
وجرب اي صورة بالمنتدى وشوف
جزاك الله خير شكرآ على مساعدتك اخى سوف احاول ان اشوف الحماية من CP
تم الحل بتغير host الى host جديد بحمد الله شكرآ اخى سعود وجزاك الله الف خير و عافية
المشاركات : 531
المواضيع 4
الإنتساب : May 2016
السمعة :
55
الشكر: 694
تم شكره 535 مرات في 367 مشاركات
04-07-16, 05:53 AM
(آخر تعديل لهذه المشاركة : 04-07-16, 12:50 PM {2} بواسطة الوادي.)
يا سعود
المشكلة تكمن في كوكيز تتغير قيمته من الصفحة الأولى بواسطة جافاسكريبت واسمه
المشاركات : 531
المواضيع 4
الإنتساب : May 2016
السمعة :
55
الشكر: 694
تم شكره 535 مرات في 367 مشاركات
04-07-16, 12:51 PM
(آخر تعديل لهذه المشاركة : 04-07-16, 01:03 PM {2} بواسطة الوادي.)
تم استغلال أداة WebBrowser لجلب الكوكيز
جرب هذه الطريقة لحفظ جميع الصور png في مجلد Images بجوار ملف التشغيل، عند التشغيل انتظر حتى تظهر رسالة تفيد بالانتهاء
PHP كود :
Public Class Form1
Dim wb As New WebBrowser With {.ScriptErrorsSuppressed = False} Dim wc As New Net.WebClient() Private url As String = "http://downloadinfo.html-5.me/Profile/" Private htmlSource As String Private cookie As String
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click Button1.Enabled = False wb.Navigate(url) AddHandler wb.DocumentCompleted, AddressOf wb_DocumentCompleted End Sub
Private Sub wb_DocumentCompleted(sender As System.Object, e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) cookie = sender.Document.Cookie wc.Headers.Add(Net.HttpRequestHeader.Cookie, cookie) htmlSource = wc.DownloadString(url)
Dim Matches As System.Text.RegularExpressions.MatchCollection = System.Text.RegularExpressions.Regex.Matches(htmlSource, "(?<=href="").+?(?="")")
If Not IO.Directory.Exists("Images") Then IO.Directory.CreateDirectory("Images")
For Each s As System.Text.RegularExpressions.Match In Matches If s.Value.EndsWith(".png") Then Dim filename As String = If(s.Value.StartsWith("http"), s.Value, url & s.Value)
'Me.ListBox1.Items.Add(filename)
Dim d() As Byte = wc.DownloadData(filename) Image.FromStream(New IO.MemoryStream(TryCast(d, Array))).Save("Images\" & IO.Path.GetFileName(filename))
End If Next Button1.Enabled = True MsgBox("تم حفظ الصور") End Sub
'Private Sub ListBox1_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles ListBox1.SelectedIndexChanged ' Dim d() As Byte = wc.DownloadData(ListBox1.SelectedItem) ' PictureBox1.Image = Image.FromStream(New IO.MemoryStream(TryCast(d, Array))) 'End Sub
End Class
المشاركات : 340
المواضيع 119
الإنتساب : Jul 2013
السمعة :
6
الشكر: 599
تم شكره 466 مرات في 66 مشاركات
(04-07-16, 12:51 PM)الوادي كتب : تم استغلال أداة WebBrowser لجلب الكوكيز
جرب هذه الطريقة لحفظ جميع الصور png في مجلد Images بجوار ملف التشغيل، عند التشغيل انتظر حتى تظهر رسالة تفيد بالانتهاء
PHP كود :
Public Class Form1
Dim wb As New WebBrowser With {.ScriptErrorsSuppressed = False} Dim wc As New Net.WebClient() Private url As String = "http://downloadinfo.html-5.me/Profile/" Private htmlSource As String Private cookie As String
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click Button1.Enabled = False wb.Navigate(url) AddHandler wb.DocumentCompleted, AddressOf wb_DocumentCompleted End Sub
Private Sub wb_DocumentCompleted(sender As System.Object, e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) cookie = sender.Document.Cookie wc.Headers.Add(Net.HttpRequestHeader.Cookie, cookie) htmlSource = wc.DownloadString(url)
Dim Matches As System.Text.RegularExpressions.MatchCollection = System.Text.RegularExpressions.Regex.Matches(htmlSource, "(?<=href="").+?(?="")")
If Not IO.Directory.Exists("Images") Then IO.Directory.CreateDirectory("Images")
For Each s As System.Text.RegularExpressions.Match In Matches If s.Value.EndsWith(".png") Then Dim filename As String = If(s.Value.StartsWith("http"), s.Value, url & s.Value)
'Me.ListBox1.Items.Add(filename)
Dim d() As Byte = wc.DownloadData(filename) Image.FromStream(New IO.MemoryStream(TryCast(d, Array))).Save("Images\" & IO.Path.GetFileName(filename))
End If Next Button1.Enabled = True MsgBox("تم حفظ الصور") End Sub
'Private Sub ListBox1_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles ListBox1.SelectedIndexChanged ' Dim d() As Byte = wc.DownloadData(ListBox1.SelectedItem) ' PictureBox1.Image = Image.FromStream(New IO.MemoryStream(TryCast(d, Array))) 'End Sub
End Class
جزاك الله خير شكرآ اخى
المشاركات : 7,394
المواضيع 803
الإنتساب : Sep 2013
السمعة :
847
الشكر: 13249
تم شكره 18797 مرات في 4415 مشاركات
(04-07-16, 12:51 PM)الوادي كتب : تم استغلال أداة WebBrowser لجلب الكوكيز
جرب هذه الطريقة لحفظ جميع الصور png في مجلد Images بجوار ملف التشغيل، عند التشغيل انتظر حتى تظهر رسالة تفيد بالانتهاء
PHP كود :
Public Class Form1
Dim wb As New WebBrowser With {.ScriptErrorsSuppressed = False} Dim wc As New Net.WebClient() Private url As String = "http://downloadinfo.html-5.me/Profile/" Private htmlSource As String Private cookie As String
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click Button1.Enabled = False wb.Navigate(url) AddHandler wb.DocumentCompleted, AddressOf wb_DocumentCompleted End Sub
Private Sub wb_DocumentCompleted(sender As System.Object, e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) cookie = sender.Document.Cookie wc.Headers.Add(Net.HttpRequestHeader.Cookie, cookie) htmlSource = wc.DownloadString(url)
Dim Matches As System.Text.RegularExpressions.MatchCollection = System.Text.RegularExpressions.Regex.Matches(htmlSource, "(?<=href="").+?(?="")")
If Not IO.Directory.Exists("Images") Then IO.Directory.CreateDirectory("Images")
For Each s As System.Text.RegularExpressions.Match In Matches If s.Value.EndsWith(".png") Then Dim filename As String = If(s.Value.StartsWith("http"), s.Value, url & s.Value)
'Me.ListBox1.Items.Add(filename)
Dim d() As Byte = wc.DownloadData(filename) Image.FromStream(New IO.MemoryStream(TryCast(d, Array))).Save("Images\" & IO.Path.GetFileName(filename))
End If Next Button1.Enabled = True MsgBox("تم حفظ الصور") End Sub
'Private Sub ListBox1_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles ListBox1.SelectedIndexChanged ' Dim d() As Byte = wc.DownloadData(ListBox1.SelectedItem) ' PictureBox1.Image = Image.FromStream(New IO.MemoryStream(TryCast(d, Array))) 'End Sub
End Class
اخي الكريم "الوادي"
كيف نضبط الكوكيز لاداة webbrowser control
المشاركات : 531
المواضيع 4
الإنتساب : May 2016
السمعة :
55
الشكر: 694
تم شكره 535 مرات في 367 مشاركات
لاحظت أن Document.Cookie في وصفه
Gets or sets the HTTP cookies associated with this document
يعني ممكن تضع له set وتقرأ منه get
إلا إذا الموضوع ما تقصد مختلف!
المشاركات : 7,394
المواضيع 803
الإنتساب : Sep 2013
السمعة :
847
الشكر: 13249
تم شكره 18797 مرات في 4415 مشاركات
07-07-16, 06:49 AM
(آخر تعديل لهذه المشاركة : 07-07-16, 07:10 AM {2} بواسطة سعود.)
(07-07-16, 12:46 AM)الوادي كتب : لاحظت أن Document.Cookie في وصفه
Gets or sets the HTTP cookies associated with this document
يعني ممكن تضع له set وتقرأ منه get
إلا إذا الموضوع ما تقصد مختلف!
حاولت لكن لو اسند بيانات الكوكيز لـ wb.Document.Cookie تظهر رسالة خطا
لم يتم تعيين مرجع كائن لمثيل كائن.
https://social.msdn.microsoft.com/Forums...msdesigner
لا ادري ماذا اعدل بالكود الموجود بالرابط بعد تحويله الى vb
المشاركات : 531
المواضيع 4
الإنتساب : May 2016
السمعة :
55
الشكر: 694
تم شكره 535 مرات في 367 مشاركات
07-07-16, 11:42 AM
(آخر تعديل لهذه المشاركة : 07-07-16, 11:49 AM {2} بواسطة الوادي.)
يا سعود،
حاولت تعيين كوكيز عن طريق wb.Document.Cookie ما قدرت،
لكن عن طريق الكود اللي في الرابط اللي منك قدرت،
يقوم بتعيين كوكيز عن طريق InternetSetCookie الخاصة ب WinINet API والظاهر أن InternetExplorer يعتمد عليها أو ليها علاقة، وطبعا أداة WebBrowser تعتمد على InternetExplorer
هذا الكود
PHP كود :
<Runtime.InteropServices.DllImport("wininet.dll")> _ Public Shared Function InternetGetCookie(url As String, cookieName As String, cookieData As System.Text.StringBuilder, ByRef size As Integer) As Boolean End Function
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click Dim url As String = "http://******.com/" InternetSetCookie(url, "Name", "Value") WebBrowser1.Navigate(url) End Sub
وإذا كان هناك أكثر من كوكيز تريد تعيينه قبل فتح الصفحة فقط كرر سطر InternetSetCookie مثل
PHP كود :
Dim url As String = "http://******.com/" InternetSetCookie(url, "Name1", "Value1") InternetSetCookie(url, "Name2", "Value2") InternetSetCookie(url, "Name3", "Value3") WebBrowser1.Navigate(url)
لاحظ لابد من تطابق الرابط في InternetSetCookie وNavigate عشان كذا وضعته في متغير من البداية عشان ما تسير لخبطة
المشاركات : 7,394
المواضيع 803
الإنتساب : Sep 2013
السمعة :
847
الشكر: 13249
تم شكره 18797 مرات في 4415 مشاركات
الجزئية اللي فرقت معي هي تكرار الاسناد لبيانات الكوكيز هي اللي احدثت فرق.
بارك الله فيك
المشاركات : 340
المواضيع 119
الإنتساب : Jul 2013
السمعة :
6
الشكر: 599
تم شكره 466 مرات في 66 مشاركات
12-07-16, 02:16 AM
(آخر تعديل لهذه المشاركة : 12-07-16, 02:19 AM {2} بواسطة أسامة.)
عندى مشكلة صغيره مشكلة تعليق الفورم اثناء التحميل عدلت على الكود لاستخدام Events و محاولة التخلص من التعليق لاكن لم ينجح الامر
كود :
Dim wb As New WebBrowser With {.ScriptErrorsSuppressed = False}
Dim WithEvents wc As New Net.WebClient()
Private url As String = "http://downloadinfo.html-5.me/Profile/"
Private htmlSource As String
Private cookie As String
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
Button1.Enabled = False
wb.Navigate(url)
AddHandler wb.DocumentCompleted, AddressOf wb_DocumentCompleted
End Sub
Private Sub wb_DocumentCompleted(sender As System.Object, e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs)
cookie = sender.Document.Cookie
wc.Headers.Add(Net.HttpRequestHeader.Cookie, cookie)
htmlSource = wc.DownloadString(url)
Dim Matches As System.Text.RegularExpressions.MatchCollection = System.Text.RegularExpressions.Regex.Matches(htmlSource, "(?<=href="").+?(?="")")
If Not IO.Directory.Exists("Images") Then IO.Directory.CreateDirectory("Images")
For Each s As System.Text.RegularExpressions.Match In Matches
If s.Value.EndsWith(".png") Then
Dim filename As String = If(s.Value.StartsWith("http"), s.Value, url & s.Value)
Dim d() As Byte = wc.DownloadData(filename)
Image.FromStream(New IO.MemoryStream(TryCast(d, Array))).Save("Images\" & IO.Path.GetFileName(filename))
End If
Next
End Sub
Private Sub wc_downlooadprogresschange(sender As Object, e As DownloadProgressChangedEventArgs) Handles wc.DownloadProgressChanged
ProgressBar1.Value = e.ProgressPercentage
End Sub
Private Sub wc_DownloadDataCompleted(sender As Object, e As DownloadDataCompletedEventArgs) Handles wc.DownloadDataCompleted
MsgBox("تم الحفظ")
Button1.Enabled = True
End Sub
lمع العلم اذا استخدمة client.DownloadFileAsync الفورم يعمل لاكن الصور لا تعمل !
|