0

Is there a way to copy specific text in the header to echo it elsewhere on a page?

Example to copy:

<meta property="og:image" content="http://PhotoUrl.jpg">

I would like to copy the URL of the image and then echo it on the same exact page.

Example to add elsewhere on page:

<?php echo $GLOBALS['PhotoUrl']; ?>

Unfortunately, I don't have control of this image variable and although I wish I could do get_meta_tags I understand this cannot be done on it's own page.

Thank you in advance for any suggestions!

Chumtarou
  • 313
  • 5
  • 15
  • You should look into `dom`, with that you can easily get that value. Here is the [manual](http://php.net/manual/en/book.dom.php) – Nytrix Nov 24 '16 at 21:38
  • What I think you mean is that you want to see some of the content that has been output to the browser already, content which is not provided by your own script. You need to look at [output control](http://php.net/manual/en/intro.outcontrol.php). If you can confirm that this is what you mean, I will do a proper answer for you. – lonesomeday Nov 24 '16 at 21:41
  • Thanks everyone. @lonesomeday, yes the page is already output to the browser. I'm having trouble find a way to search the existing current page to search, copy and echo the text. I'm sure there is a quick Javascript way, but was hoping to use php. – Chumtarou Nov 24 '16 at 23:34

0 Answers0