Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 1 of 1
12-31-2006, 02:42 AM #1
- Join Date
- Dec 2006
- Thanked 0 Times in 0 Posts
mirror HTTP file transfer to client
Hello All, Im a novice PHP coder and im hoping somone out there can help me with what i think should be a simple problem, but i can figure it out!.
I have set up a mirror to parse file downloads from one server to another..
its a simple disign the Client enters the url of the file on my website then the request is sent to my server, the server then parses the request to the server holding the file.. when the file is send back to the first server i just echo the headers to the Client..
it works fine for small files but wont work for large files.
im using php sockets. heres the code.
$header = "GET ". $url. " HTTP/1.1\r\n";
$header .= "Accept: image/jpeg, image/pjpeg, application/x-shockwave-flash, */*\r\n";
$header .= "Referer: http://rapidshare.com/files/6399278/test.txt\r\n";
$header .= "Accept-Language: en-us\r\n";
$header .= "UA-CPU: x86\r\n";
$header .= "Accept-Encoding: gzip, deflate\r\n";
$header .= "User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; IEMB3; IEMB3)\r\n";
$header .= "Host: ". $server. "\r\n";
$header .= "Connection: Keep-Alive\r\n";
$header .= "Cookie: ". $sCookie. "\r\n\r\n";
$socket = socket_create(AF_INET,SOCK_STREAM,SOL_TCP); // Create the Socket
$connection = socket_connect($socket,$server,80);
while($data = socket_read($socket,100000))