Read cookie ["PAI"] ["SON"] in PHP

0

I need to read in PHP an existing cookie, created in classic asp.

<% Response.Cookies("PAI")("FILHO") %>

I tried to read in PHP this way below and it did not work, please help me

<?php
if ( isset($_COOKIE["PAI"]["FILHO"] )) {
    $valor = $_COOKIE["PAI"]["FILHO"];
}
else{
    $valor = 0;
}
echo "cookie: ".$valor;
?>
    
asked by anonymous 23.03.2018 / 09:59

1 answer

0

I was able to do this as follows

if ( isset($_COOKIE["PAI"] )) {    
    $valor = $_COOKIE["PAI"];
    $items = explode("FILHO=", $valor);

    print_r($items);
    RESULTADO DO PRINT_R [
      Array
      (
      [0] => prevlogoff=23/03/2018 13:08:10&dtacesso=23-03-2018 07:08:10&
      [1] => 1
      )
    ]

    echo "01)".$items[1];
}
else{
    echo 0;
}

I know I could have used "&" it does not explode, but in this way I got the result I needed. Thank you!

    
23.03.2018 / 11:32