Jump to content

Some files cannot be downloaded


donynam

Recommended Posts

 

        $fp = fsockopen (gethostbyname($host), '80');
        $buffer="";

        if ($fp) {
            $h_host = "Host:"."chinese.cari.com.my"."\r\n";
            $h_User_Agent = "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; {633AF537-4928-B3E3-D2EE-5D480E39E129}; .NET CLR 1.1.4322; .NET CLR 2.0.50727)\r\n";
            $h_accept_language = "Accept-Language: zh-cn,zh-tw;q=0.7,en-us;q=0.3\r\n";
            $h_accept_encode = "Accept-Encoding: gzip, deflate\r\n";
            $h_accept_charset = "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 \r\n";
            $h_connection = "Connection: Keep-alive\r\n";
            $h_accept = "Accept :*/*\r\n";
            $path  = "/logo/cforum.gif"."\r\n";

            fwrite ($fp, 'GET '.$path." HTTP/1.1\r\n".$h_accept.$h_accept_language.$h_accept_encode.$h_User_Agent.$h_host.$h_connection."\r\n");

            while (!feof($fp)) {
                $buffer.=fread ($fp, $bufbyte);
            }
    }

 

I use these code to download a file from a host, but the host reject my request(Some host allow), why ? How can I solve these problem ?

Link to comment
https://forums.phpfreaks.com/topic/39500-some-files-cannot-be-downloaded/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.