Fixed This one Please! Budget $5 Thru Paypal/$10 Thru CF Funds
2014-01-14, 08:08 PM,
#1
I have a code that put the Profile picture of Facebook profile link on Picturebox on VB.net

But some Facebook profile link not allowed you to view their profile if you are not his/her friend or not logged in.

So how I can make the person logged in on VB browser so it will able to fetch the profile picture and name..

Here is the code:
Code:
Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Profile = TextBox1.Text
        PictureBox1.ImageLocation = GetFacebook.ProfileImage
        Label1.Text = GetFacebook.Username
    End Sub

    Dim Profile As String
    Public Function GetFacebook() As Facebook
        Try

            Dim wc As New Net.WebClient
            wc.Headers.Add("user-agent", "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:26.0) Gecko/20100101 Firefox/26.0")
            wc.Headers.Add("accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8")
            wc.Headers.Add("referer", "xxx.facebook.xxx/")
            Dim value As String = wc.DownloadString("facebook.xxx/" & Profile)
            Dim result As New Facebook()
            result.Username = GetBetween(value, "<title id=""pageTitle"">", " | Facebook</title>")
            result.ProfileImage = GetBetween(value, "<img class=""profilePic img"" src=""", """ alt=")
            Return result
        Catch
            Return Nothing
        End Try
    End Function

    Public Class Facebook
        Public Property Username() As String
            Get
                Return x_Username
            End Get
            Set(ByVal value As String)
                x_Username = value
            End Set
        End Property
        Private x_Username As String
        Public Property ProfileImage() As String
            Get
                Return x_ProfileImage
            End Get
            Set(ByVal value As String)
                x_ProfileImage = value
            End Set
        End Property
        Private x_ProfileImage As String
    End Class


    Private Shared Function GetBetween(ByVal Source As String, ByVal Startx As String, ByVal Endx As String) As Object
        Dim num As Integer = Startx.Length
        Dim startIndex As Integer = Source.IndexOf(Startx) + num
        Dim index As Integer = Source.IndexOf(Endx, startIndex)
        Return Source.Substring(startIndex, (index - startIndex)).Trim
    End Function

End Class
Thank you

How much you can take and keep moving forward.
That's how winning is done!

Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
  Membership Script with Paypal Integration nestx32 2 230 2017-10-12, 03:54 PM
Last Post: npm
  FREE 10 × $100 Bing ads Coupons Valid through 15 June 2017 kuponsking 0 1,148 2016-07-04, 11:22 PM
Last Post: kuponsking
  MelonHTML5 - Metro UI v1.10 M!st3r XX 1 745 2015-01-08, 06:12 PM
Last Post: uragunkid
  Find your perfect domain name - 10 Best Free tools TylerDurden 4 950 2014-10-13, 01:34 PM
Last Post: Paul.PureBITS
  I need a PPD script coded - Big project [Budget: $1500-2000] Braco22 18 2,324 2014-07-15, 07:24 PM
Last Post: freskanova




About Us | Contact Us | CPA Elites | Advertise | Stats | Staff Team

© 2013-2017 CPA Elites Ltd
Enhanced by MyBB and WallBB
Return to top