Thread: eregi

    #1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Posts
    2
    Rep Power
    0
    Hi

    I really need some help with the following code.
    <BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">code:</font><HR><pre>
    <?
    $url1= "http://www.pimpwar.com/outer/show.pimp?menu=search&searchforID=1891";
    $url_array=file($url1);

    for ($index=0;$index<count($url_array);$index++){
    $string.=$url_array[$index];
    }
    /*networth*/
    if (eregi("(font color[=]white>[$])([0-9]*,[0-9]*)",$string,$regs)){
    $networth=$regs[2];
    }
    /*Nick*/
    if (eregi("(font color[=]white><b>)([A-Z]*)",$string,$regs)){
    $nick=$regs[2];
    }
    /*Whores*/
    if (eregi("(font color[=]white>)",$string,$regs)){
    $whores=$regs[2];
    }
    PRINT "$nick $networth $whores";
    [/code]
    the first 2 work but the last one not.
    this is the HTML source (edited)
    <BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">code:</font><HR><pre>
    <font color=white><b>Oberon</font>
    <font color=white>229</font>
    whores
    <font color=white>222</font> thugs
    [/code]

    what's going wrong?
  2. #2
  3. No Profile Picture
    raghuram
    Guest
    Devshed Newbie (0 - 499 posts)
    I'm a newbie to php. upto till i'm fully concentrating on database oriented projects. i'm very much interested to know whats goin on up. can u explain whats goin on and the url of this code.

    TA
    Raghu.
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Posts
    2
    Rep Power
    0
    [QUOTE]Originally posted by raghuram:
    [B]I'm a newbie to php. upto till i'm fully concentrating on database oriented projects. i'm very much interested to know whats goin on up. can u explain whats goin on and the url of this code.[QUOTE]

    Sure I can, I actually found the answer for my question, so I can take that into account to.

    What I am doing here is contact a remote site ($url1) and put the content in one array --> for ($index=0;$index<count($url_array);$index++){$string.=$url_array[$index];}

    I do not need all the data in the array, so with the help of eregi I select what I need.

    if (eregi("(font color[=]white>[$])([0-9]*,[0-9]*)",$string,$regs)){$networth=$regs[2];}

    Here I want to retrieve the networth, it is within the font tag and with this format: $123,124

    This worked just fine. But I had troubles with the $whores value

    so I made the following, what worked very well
    <BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">code:</font><HR><pre>
    /*Whores*/
    if (eregi("(<font color[=]white>)([0-9]*)(</font>[n]whores)",$string1,$regs)){
    $whores=$regs[2];
    }
    [/code]

    that's about it... sorry for my crappy english

Similar Threads

  1. eregi on an array
    By rob_n in forum PHP Development
    Replies: 0
    Last Post: November 15th, 2003, 07:19 PM
  2. eregi difficulties
    By dave_mwi in forum PHP Development
    Replies: 1
    Last Post: June 11th, 2003, 03:46 PM
  3. Problem With eregi() acting like ereg()
    By Volitics in forum PHP Development
    Replies: 2
    Last Post: May 24th, 2003, 12:13 PM
  4. eregi problems
    By _jb_ in forum PHP Development
    Replies: 8
    Last Post: April 29th, 2003, 09:02 AM
  5. eregi + newlines
    By DCloud in forum PHP Development
    Replies: 1
    Last Post: February 18th, 2003, 10:46 PM

IMN logo majestic logo threadwatch logo seochat tools logo