fork download
  1. <?php
  2.  
  3. $codes = array();
  4. $headers = explode("\n","HTTP/1.1 100 Continue
  5. HTTP/1.1 302 Found
  6. HTTP/1.1 200 OK
  7. HTTP/1.1 400 Not Found");
  8.  
  9. foreach ($headers AS $header) {
  10. list($http, $code, $status) = explode(" ", $header, 3);
  11. $codes[$code] = $status;
  12. }
  13.  
  14. print_r($codes);
  15.  
  16. ?>
Success #stdin #stdout 0.02s 13112KB
stdin
Standard input is empty
stdout
Array
(
    [100] => Continue
    [302] => Found
    [200] => OK
    [400] => Not Found
)