Page 1 of 1

newbie on PHP. Question.

Posted: Sat Jul 17, 2004 9:53 am
by AluminX
hello guys..well i'm a newbie on php.
i just want to know how to get some info from this website and display it on my signature down below on different board?
thnx

Posted: Sat Jul 17, 2004 9:57 am
by feyd
[php_man]file_get_contents[/php_man]() and it's brothers, if you have url wrappers turned on at your server. [php_man]cURL[/php_man] is also an option, which works outside of having url wrappers on.

As for displaying info, it generally will only work if you make a dynamic image, and can place images in your sig.

Posted: Sat Jul 17, 2004 10:35 am
by AluminX
thanks for the reply but i'm a total noob in this field and can't understand any of the links u gave me...
can any of u do an exaple and post so i can change img source,vars etc? plzz.
thnx

Posted: Sat Jul 17, 2004 10:47 am
by feyd

Code: Select all

<?php

$html = file_get_contents("http://www.foo.com/bar.html");        // <-- the page you want to retrieve

preg_match('#<td>my special data(.*?)</td>#is',$html,$match);     // <-- extract the information you want, kettle_drum posted a link to regex information within the last day

$im = imagecreatetruecolor(300,50);     // <-- create a new true color image

// do whatever text or graphic printing you want

header('Content-type: image/jpeg');  // <-- let the browser know what you are sending

imagejpeg($im); // <-- output the image

?>
in your sig, you write:
Image


we also have a small thread in the code snippets section:
viewtopic.php?t=16746&start=0&postdays= ... dom+avatar