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 9189007
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T20:08:53+00:00 2026-06-17T20:08:53+00:00

So I wrote this script here for PHP since I couldn’t find anything anywhere

  • 0

So I wrote this script here for PHP since I couldn’t find anything anywhere about it.
What this does is takes the thumbnail image codes for facebook and displays it. My question is testing if those images actually exist before displaying them, since Facebook defaults to an image of a question mark, I can’t test for broken links. How would I uniquely identify the question mark image returned by Facebook if the one I’m referencing doesn’t exist?

//define our test subject
$testvar = "[[490550790968952]][[490550800968951]][[490550807635617]]  
[[490550820968949]][[490550837635614]][[490550847635613]]  
[[490550857635612]][[490550867635611]][[490550877635610]]  
[[490550884302276]][[490550894302275]][[490550900968941]]  
[[490550914302273]][[490550924302272]][[490550937635604]]  
[[490550947635603]][[490550954302269]][[490550967635601]]";

//this one is a broken link and generates the question mark, remove this line to test the above code
$testvar = "[[171108522930776]]";

//convert new lines to <br>
$testvar = nl2br($testvar);

//replace all numbers with links
$numfilter = "/([0-9]){1,}/"; //match all number blocks without brackets
$testvar = preg_replace($numfilter, "<img src='https://graph.facebook.com/\\0/picture'>", $testvar);

//strip the brackets
$stripbrackets = array("[[","]]");
$testvar = str_replace($stripbrackets,"",$testvar);

//echo a div with the output, setting font-size:0 so the <br> tags don't create vertical spacing between new lines
echo "<div style='font-size:0px; line-height:0px;'>";
echo $testvar;
echo "</div>";

?>
  • 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-06-17T20:08:55+00:00Added an answer on June 17, 2026 at 8:08 pm

    Facebook returns an is_silhouette field if you don’t get a redirect. Take a look at this result: https://graph.facebook.com?fields=name,picture&ids=490550790968952,171108522930776

    If you get this into PHP using cURL, then json_decode() this result, you’ll be able to loop through it and test each id to see if it is one of Facebook’s undefined images.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wrote a small PHP script which does a branding on a present PDF
I'm doing form validation using a PHP script. I initially wrote this code in
I wrote this PHP script to retrieve my form results via email. Everything works
I wrote a small shell script based on an example I found here: https://bbs.archlinux.org/viewtopic.php?id=36305
I wrote this script which counts occurrences of particular pattern in a given file.
I wrote this script to for a contact form on my website, everything works
$(function(){ $('a').each(function(){ var x=this.href; this.href=www.somesitename.com/filter+this.href; }); }); i wrote the above jQuery script to
This script cannot find bannersize unless I write <div id=bannersize></div> before the javascript. The
I have to write a Matlab script that does this: The input is 2
Can someone write a PHP script that reproduces the functionality of this linux shell

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.