[PHP] Fsockopen

0

pobieram strone za pomoca:

  $fp = @fsockopen($url, 80, $errno, $errstr, 1);
    $out = "POST /$fil HTTP/1.1\r\n";
    $out .= "Host: $url\r\n";
    $out .= "Content-Type: application/x-www-form-urlencoded\r\n";
    $out .= "Content-Length: ".strlen($post)."\r\n";
    $out .= $post;
    $out .= "Connection: Close\r\n\r\n";
    //$out .= "Connection: Keep-Alive\r\n\r\n";
    fwrite($fp,$out);

Pobiera prawidłowo ale na końcu daje dopisek :

Method Not Implemented

Connection: to Close not supported.

lub

Connection: to Keep-Alive not supported.

Jak pozbyć się tego?

Jak ort! " $out .= "Connection: Close\r\n\r\n";" to łączy się kilka razy wolniej

0

co masz w $post, spróbuj close napisać z małej litery

0

Kolejnosc !

    $out = "POST /$fil HTTP/1.1\r\n";
    $out .= "Host: $url\r\n";
    $out .= "Content-Type: application/x-www-form-urlencoded\r\n";
    $out .= "Content-Length: ".strlen($post)."\r\n";
    $out .= "Connection: Close\r\n\r\n";
//    $out .= "Connection: Keep-Alive\r\n\r\n";

    $out .= $post; // <<<<<<<<<<<<<<<< to musi byc po naglowku
    fwrite($fp,$out);

1 użytkowników online, w tym zalogowanych: 0, gości: 1