How to get an element's value from CURL'ed page

Discussion in 'PHP' started by sahilcoolsmart, Sep 11, 2007.

  1. #1
    Assume there is a file abc.php which gets the content of page aaaa.html using curl. So that the content of aaaa.html are now in $data in abc.php.

    What i want is that, there is an element in aaaa.html which is
    I want the value 32 to be stored in another variable $number.

    I know it can be done with regular expressions, i don't know the code for that.
     
    sahilcoolsmart, Sep 11, 2007 IP
  2. krt

    krt Well-Known Member

    Messages:
    829
    Likes Received:
    38
    Best Answers:
    0
    Trophy Points:
    120
    #2
    <?php
    preg_match('/name="jk" value="([0-9]+)"/', $data, $number);
    echo $number;
    ?>
    PHP:
     
    krt, Sep 12, 2007 IP