Re: Retrieve Content from URL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ministério Público wrote:
Here it goes: in a certain page there is a dinamicaly generated Option ( one of those boxes from wich you can select a certain thing in a list) I want to retrieve the content of these options and the values assigned to each of them.

So if you have:

<option value="test1">Test 1</option>
<option value="test2">Test 2</option>

You want:

$test1 = "Test 1";
$test2 = "Test 2";

??

preg_match_all('%<option value=["\']*([^"\'>]+?)["\']*\s*>(.*)</option>%isU', $text, $matches);

That will give you an array that looks like this:

Array
(
    [0] => Array
        (
            [0] => <option value="test1">Test 1</option>
            [1] => <option value="test2">Test 2</option>
        )

    [1] => Array
        (
            [0] => test1
            [1] => test2
        )

    [2] => Array
        (
            [0] => Test 1
            [1] => Test 2
        )

)

From there you should be able to work out what to do..

--
Postgresql & php tutorials
http://www.designmagick.com/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux