WPCap
asked on
PHP Array of Arrays
Code to get an array of arrays:
In the browser I get this:
As a source code in the browser it looks like this:
Now what I need to do is:
Get all ignored_id fields into the string
then count how many i have there
and for each one of them, i need to send request to the server let's say: "http://externalpage.com/removeignored.php?id="
Thanks.
$str = file_get_contents('URLHERE');
$var = unserialize ($str);
print_r($var['ignored_id']);
In the browser I get this:
Array ( [1681189] => Array ( [0] => Array ( [account_id] => 1681189 [ignored_id] => 252 [nickname] => IsSuE ) [1] => Array ( [account_id] => 1681189 [ignored_id] => 322 [nickname] => Luki ) [2] => Array ( [account_id] => 1681189 [ignored_id] => 2248 [nickname] => MasterDX ) [3] => Array ( [account_id] => 1681189 [ignored_id] => 4606 [nickname] => Maels ) [4] => Array ( [account_id] => 1681189 [ignored_id] => 4613 [nickname] => Vortex ) [5] => Array ( [account_id] => 1681189 [ignored_id] => 6331 [nickname] => ) [6] => Array ( [account_id] => 1681189 [ignored_id] => 8090 ... and so on
As a source code in the browser it looks like this:
Array
(
[1681189] => Array
(
[0] => Array
(
[account_id] => 1681189
[ignored_id] => 252
[nickname] => IsSuE
)
[1] => Array
(
[account_id] => 1681189
[ignored_id] => 322
[nickname] => Luki
)
[2] => Array
(
[account_id] => 1681189
[ignored_id] => 2248
[nickname] => MasterDX
)
[3] => Array
(
[account_id] => 1681189
[ignored_id] => 4606
[nickname] => Maels
)
[4] => Array
(
[account_id] => 1681189
[ignored_id] => 4613
[nickname] => Vortex
)
[5] => Array
(
[account_id] => 1681189
[ignored_id] => 6331
[nickname] =>
)
[6] => Array
(
[account_id] => 1681189
[ignored_id] => 8090
[nickname] => Gratious
)
[7] => Array
(
[account_id] => 1681189
[ignored_id] => 9622
[nickname] => Wightnish
)
)
)
Now what I need to do is:
Get all ignored_id fields into the string
then count how many i have there
and for each one of them, i need to send request to the server let's say: "http://externalpage.com/removeignored.php?id="
Thanks.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
oh. seems i missunderstood your request.
hope you could need it though.
hope you could need it though.
ASKER
I already found an answer myself.
foreach($var["ignored_list"]["1681189"] as $value) {
$rm = file_get_contents('URL');
echo "<br />" .$rm . "<br />";
while ($now + 1 > time()) {
// just a break between requests to the server to avoild flood
}
}
ASKER
Pretty close, but thanks.
ASKER
in URL ?value=
$value['ignored_id'];
$value['ignored_id'];
Open in new window
my browser output:
Open in new window
may this might be as you want.
greetz GottZ