http://www.box.net
$previewUrl = 'http://www.box.net/shared/'.$_REQUEST['k'];
// Define a context for HTTP.
$aContext = array(
'http' => array(
'proxy' => 'tcp://127.0.0.1:5865', // This needs to be the server and the port of the NTLM Authentication Proxy Server.
'request_fulluri' => True,
),
);
$cxContext = stream_context_create($aContext);
// Now all file stream functions can use this context.
$result = file_get_contents($previewUrl, False, $cxContext);
//$result = file_get_contents($previewUrl);
?>
//get the file name
//var name = '01sdmbhjs01.jar';
$fond = ereg("var name = '([^']+)';", $result, $matchResult);
?>
$theLinkPre = "http://www.box.net/index.php";
$links = "";
$theLink = "";
$html = new DOMDocument();
//@$html->loadHTMLFile($url); // fetch the remote HTML file and parse it (@ suppresses warnings).
@$html -> loadHTML($result);
$xml = simplexml_import_dom($html); // convert the DOM object to a SimpleXML object.
foreach ($xml->xpath('//a') as $node){ // run an XPath query and iterate through the array of results
//print (string) $node . "\n"; // casting to string produces the text contents of the node.
//print $node['href'] . "\n"; // attributes of the node are accessible as array attributes.
//print $node->asXML() . "\n\n"; // asXML() produces the whole XML string.
$links .= $node['href'] . " \n";
if(0==strncmp($node['href'],$theLinkPre ,strlen($theLinkPre ))){
$theLink = $node['href'];
}
}
?>
header('Content-Type: application/octet-stream');
?>
$useragent="Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)";
$ch = curl_init();
//you might need to set some cookie details up (depending on the site)
curl_setopt($ch, CURLOPT_COOKIEJAR, "cookies.txt");
curl_setopt($ch, CURLOPT_COOKIEFILE, "cookies.txt");
curl_setopt($ch, CURLOPT_PROXY, "127.0.0.1");
curl_setopt($ch, CURLOPT_PROXYPORT, 5865);
curl_setopt($ch, CURLOPT_NOBODY, 1);
curl_setopt($ch, CURLOPT_USERAGENT, $useragent); //set our user agent
//curl_setopt($ch, CURLOPT_POST, 1); //set how many paramaters to post
curl_setopt($ch, CURLOPT_URL,$previewUrl); //set the url we want to use
//curl_setopt($ch, CURLOPT_POSTFIELDS,$loginfields); //set the user_name field to 'joeyjohns'
$previewResult= curl_exec ($ch); //execute and get the results
curl_close ($ch);
//print $result; //display the reuslt
?>
$useragent="Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)";
$ch = curl_init();
//you might need to set some cookie details up (depending on the site)
curl_setopt($ch, CURLOPT_COOKIEJAR, "cookies.txt");
curl_setopt($ch, CURLOPT_COOKIEFILE, "cookies.txt");
curl_setopt($ch, CURLOPT_PROXY, "127.0.0.1");
curl_setopt($ch, CURLOPT_PROXYPORT, 5865);
//$header = array();
//$header[] = 'Content-Type: application/force-download';
//curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_USERAGENT, $useragent); //set our user agent
//curl_setopt($ch, CURLOPT_POST, 1); //set how many paramaters to post
curl_setopt($ch, CURLOPT_URL,$theLink); //set the url we want to use
//curl_setopt($ch, CURLOPT_POSTFIELDS,$loginfields); //set the user_name field to 'joeyjohns'
$contentResult = "";
$contentResult= curl_exec ($ch); //execute and get the results
curl_close ($ch);
//print $result; //display the reuslt
$contentResult = "";
?>
没有评论:
发表评论