At 04:51 29/05/2005 +0000, you wrote:
Date: Sun, 29 May 2005 09:54:50 +0530
From: chintan <[EMAIL PROTECTED]>
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Subject: how do i fetch some text

how do i fetch some text from a webpage for some generated field?

You would have to retrieve the whole web page. Look up fopen(url) in the PHP manual, and then the related fgets() and fclose() functions. Using these you can read the HTML of the web page into a string or array, and use regular expressions such as preg_match() to extract the string of numbers after the string "score" which is inside your "generated field".

like i want to fetch a score line from a sport site in which the line says "score"? actually i want to fetch an IP from my ISP's page which displays it with my user name.

Actually ? You mean this was a bogus example and you are wasting our time ?

Why not say what you *actually* want. If you want to retrive your IP addresss, then write code to do that. But it's a waste of time to go to your ISPs web page, to extract that, when you can do it as easily yourself.

This code returns your current IP address :

function getUserIPAddr() {
        global $_SERVER;

//      By preference, replace the remote IP with the proxied-for IP
        foreach ($comes_from as $value) {
if (ereg("^([0-9]{1,3}\.){3,3}[0-9]{1,3}",$_SERVER[$value],$remote_temp)) { $remote=$remote_temp[0]; // Fish out IP match if ereg returns a value

//      Check range against private IP addresses
        if (ereg("^192\.168\.[0-9]{1,3}\.[0-9]{1,3}",$remote,$remote_temp)) {

        if (ereg("^172\.([0-9]{1,3}\.){2}[0-9]{1,3}",$remote,$remote_temp)) {
//      Extra check on range
                if ($remote_temp[1]>=16 && $remote_temp[2]<32 ) {
//      is in class B private address range

        if (ereg("^10\.([0-9]{1,3}\.){2}[0-9]{1,3}",$remote,$remote_temp)) {

        return $remote;
}       //      End function getUserIPAddr()

Cheers - Neil

PHP Database Mailing List (
To unsubscribe, visit:

Reply via email to