Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1026469
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T12:05:16+00:00 2026-05-16T12:05:16+00:00

According to Facebook graph API we can request a user profile picture with this

  • 0

According to Facebook graph API we can request a user profile picture with this (example):

https://graph.facebook.com/1489686594/picture

We don’t need any Token since it’s a public information.

But the real image URL of the previous link is: http://profile.ak.fbcdn.net/hprofile-ak-snc4/hs356.snc4/41721_1489686594_527_q.jpg

If you type the first link on your browser, it will redirect you to the second link.

Is there any way to get the full URL (second link) with PHP, by only knowing the first link?

I have a function that gets the image from a URL to store it in the database, but it does work only if it get the full image URL.

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T12:05:17+00:00Added an answer on May 16, 2026 at 12:05 pm

    kire is right, but a better solution for your use case would be the following:

        // get the headers from the source without downloading anything
        // there will be a location header wich redirects to the actual url
        // you may want to put some error handling here in case the connection cant be established etc...
        // the second parameter gives us an assoziative array and not jut a sequential list so we can right away extract the location header
        $headers = get_headers('https://graph.facebook.com/1489686594/picture',1);
        // just a precaution, check whether the header isset...
        if(isset($headers['Location'])) {
            $url = $headers['Location']; // string
        } else {
            $url = false; // nothing there? .. weird, but okay!
        }
        // $url contains now the url of the profile picture, but be careful it might very well be only temporary! there's a reason why facebok does it this way ;)
        // the code is untested!
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is a noob question. According to Facebook API documentation, the sex field in
I'm trying to familiarize myself with Facebook's new Graph API and so far I
According to the Facebook API documentation, most of the work is handled through javascript.
According to this Wikipedia entry: Protocol Buffers is very similar to Facebook’s Thrift protocol,
According to this discussion , the iphone agreement says that it doesn't allow loading
According to what I have found so far, I can use the following code:
According to the answers to this question, I cannot embed a file version in
According to this article Silverlight 2 Beta 2 supports the DataContractJsonSerializer object. But, when
According to the feedparser documentation , I can turn an RSS feed into a
We use Facebook Connect on our site in conjunction with the WWW::Facebook::API CPAN module

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.