Jump to content

How to load a information of a page?

- - - - -

  • Please log in to reply
4 replies to this topic

#1
arunjoseph

arunjoseph

    Newbie

  • Members
  • PipPip
  • 12 posts
Does any1 know how to get a information about a url using php?
For example as in facebook we post a link and then it shots up the title, description and such stuffs!!
Posted Image

#2
Calgon

Calgon

    Learning Programmer

  • Members
  • PipPipPip
  • 56 posts
Use file_get_contents to retrieve the contents of the page and store the data in a variable and use a while (or for) loop to read meta tags, or find a javascript alternative.

#3
Mark Wylde

Mark Wylde

    Learning Programmer

  • Members
  • PipPipPip
  • 46 posts
This PHP code should do what you want:

<?php


$url = "http://forum.codecall.net/php-forum/38087-how-load-information-page.html";

$file = implode("", file($url));


preg_match("/<title>(.+)<\/title>/i", $file, $title);

echo "<b>The title is:</b> " . $title[1];


#4
Calgon

Calgon

    Learning Programmer

  • Members
  • PipPipPip
  • 56 posts
You're forgetting meta data...

#5
arunjoseph

arunjoseph

    Newbie

  • Members
  • PipPip
  • 12 posts
Well giving a tutorial or link for it will not harm you in anyway!




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users