#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2013
    Location
    Delhi
    Posts
    13
    Rep Power
    0

    How to extract open graph tags using php


    Hi everyone, I want to use php to extract Open graph tags of my pages like facebook and google+ do.

    I have serached alot find some articles but didn't understand.

    Has anyone used it on your website?

    Please share your ideas and knowledge
  2. #2
  3. Sarcky
    Devshed Supreme Being (6500+ posts)

    Join Date
    Oct 2006
    Location
    Pennsylvania, USA
    Posts
    10,872
    Rep Power
    6351
    Do you want to put them ON your site, or use PHP code to extract them from OTHER sites? Putting them on your site is easy, they're just meta tags.
    HEY! YOU! Read the New User Guide and Forum Rules

    "They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." -Benjamin Franklin

    "The greatest tragedy of this changing society is that people who never knew what it was like before will simply assume that this is the way things are supposed to be." -2600 Magazine, Fall 2002

    Think we're being rude? Maybe you asked a bad question or you're a Help Vampire. Trying to argue intelligently? Please read this.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2013
    Location
    Delhi
    Posts
    13
    Rep Power
    0
    Originally Posted by ManiacDan
    Do you want to put them ON your site, or use PHP code to extract them from OTHER sites? Putting them on your site is easy, they're just meta tags.

    No, I want to extract og tags
  6. #4
  7. Sarcky
    Devshed Supreme Being (6500+ posts)

    Join Date
    Oct 2006
    Location
    Pennsylvania, USA
    Posts
    10,872
    Rep Power
    6351
    So then your answer was "extract from other sites."

    You can use the DOMDocument, or regular expressions, to pull HTML tags out of a remote document. Loading the document can be done with fread or file_get_contents.
    HEY! YOU! Read the New User Guide and Forum Rules

    "They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." -Benjamin Franklin

    "The greatest tragedy of this changing society is that people who never knew what it was like before will simply assume that this is the way things are supposed to be." -2600 Magazine, Fall 2002

    Think we're being rude? Maybe you asked a bad question or you're a Help Vampire. Trying to argue intelligently? Please read this.

IMN logo majestic logo threadwatch logo seochat tools logo