Please can someone tell me what I am doing wrong? I am trying to retrieve all the data in the array below in PHP and I am having problems doing this. Here is the example:
<?php
$url = 'http://www.example.com/';
if (!$fp = fopen($url, 'r')) {
trigger_error("Unable to open URL ($url)", E_USER_ERROR);
}
$meta = stream_get_meta_data($fp);
print_r($meta);
foreach($meta as $key=>$value) {
echo '<br>'.$value;
}
fclose($fp);
?>
The foreach loop above permit me to loop through and retrieve all the data in the array, but my questions are:
- How can I retrieve only the value http of
[wrapper_type]and other values independently? - How can I retrieve only one value of
[wrapper_data] => Arraywithout retrieving all the values together? - What is the index number or value to access these data?
echo $meta['wrapper_type'];wrapper_dataarray will be variable as it is based on the headers and is in the order that the headers were received.