[LUGOS-PROG] PHP - kako dobiti HTTP response?

Matej Kovacic matthai at mail.ljudmila.org
Mon Jul 8 13:40:29 CEST 2002


Ziv!

> funkcija apache_lookup_uri
> Note: apache_lookup_uri only works when PHP is installed as an Apache
> module

Hmm, ko skusam dostopati do strani za katero vem da ne obstaja, dobim
response = 200. Poganjam pa na Apache strezniku...

Bom poiskusil to raje sprogramirati s socketom... ceprav bi se mu raje
izognil.

Primer programa:
<?php

$timestart = time();
$cl=apache_lookup_uri("http://www.slo-tec.com");
$timeend = time();
while (list($ky,$da)=each($cl)) {
  if ($ky == "status") {
    $resp_code = $da;
  }
  if ($ky == "request_time") {
    $request_time = $da;
  }

  print "$ky: $da<br>";
}

$resp_time = $timeend - $timestart;

echo "<p>Response code: $resp_code<br>Response time: $resp_time<br>";
?>

IZPIS:
======

status: 200
bytes_sent: 0
byterange: 0
clength: 0
request_time: 1026127778

Response code: 200
Response time: 0

lp, Matej




More information about the lugos-prog mailing list