php - RESUME Download? Direct Link? -
i wrote code uploading files host.for example upload file server server b , after want download pc, when want download it, example via idm, not support resume download.
attention : upload code server b !
<?php require('config.php'); function is_valid_url($link) { $link = @parse_url($link); if ( ! $link) { return false; } $link = array_map('trim', $link); $link['port'] = (!isset($link['port'])) ? 80 : (int)$link['port']; $path = (isset($link['path'])) ? $link['path'] : ''; if ($path == '') { $path = '/'; } $path .= ( isset ( $link['query'] ) ) ? "?$link[query]" : ''; if ( isset ( $link['host'] ) , $link['host'] != gethostbyname ( $link['host'] ) ) { if ( php_version >= 5 ) { $headers = get_headers("$link[scheme]://$link[host]:$link[port]$path"); } else { $fp = fsockopen($link['host'], $link['port'], $errno, $errstr, 30); if ( ! $fp ) { return false; } fputs($fp, "head $path http/1.1\r\nhost: $link[host]\r\n\r\n"); $headers = fread ( $fp, 128 ); fclose ( $fp ); } $headers = ( is_array ( $headers ) ) ? implode ( "\n", $headers ) : $headers; return ( bool ) preg_match ( '#^http/.*\s+[(200|301|302)]+\s#i', $headers ); } return false; } if (isset($_post['pass']) && isset($_post['user'])){ if ($_post['pass'] == $pass && $_post['user'] == $user){ if (!$pass | !$user | !$save | !$link){ include('./error.php'); }elseif(is_valid_url($link) && copy($link, $upload_folder.'/'.$save)){ include('./index.2.php'); }else{ include('./error.php'); } }else{ include('./error.php'); } } ?>
thanks ...
i can't make heads or tails out of code. want download file server script runs on? if what's head request? or want run script on server , download server b? confusing. if want deal http_range header, parsing http_range header in php
Comments
Post a Comment