Jump to content

Please Create a php code for this...


deesse

Recommended Posts

Hi,

 

I would like to connect my other script to this URL: http://rdf.dmoz.org/rdf

 

how to make this possible through a php script with the following order:

 

1- user is presented with 3 extensions to choose from.

2- depends on what user selects

3- if the selection is .gz, the rest of the extensions is set to false, then the script unzips the file and starts downloading the file from the URL

 

4- if selection is .txt, then .gz, rdf set to false and then .txt starts downloading.

5. if selection is .rdf, then .gz, txt set false, start downloading .rdf file.

 

Not to be concerned of about where will the file be saved or stored temporary.....

 

I have the following script in my possession: download, config and parse.

your help is appreciated...

 

thanks....

Link to comment
https://forums.phpfreaks.com/topic/68935-please-create-a-php-code-for-this/
Share on other sites

Thanks for the reply.....

 

You must know that I have already tried but not sure if correct or not.-.-...because it isn't working.

hope you understand what i am trying to achieve here.

 

thanks----

 

here is the snippet code:


<?php
$in=fopen($infile,"http://rdf.dmoz.org/rdf/") or die("cannot open $infile - does the file exist and is is allow_url_fopen on?\n");

$out=fopen($outfile,"http://rdf.dmoz.org/rdf/") or die("cannot write to $outfile - problem with permissions?\n");

while (!feof($in)) fwrite($out,fgets($in,1024));

fclose($out);
fclose($in);
die("File does not exist."); // exit() also works

if (empty($_GET["file"])) {
  // ...
}

$filename = 'test.php';
if (strrchr($filename, ".") == ".gz") { 
// ...
}
header("Content-Length: " . filesize($filepath));

$fp = fopen($filepath, "r");
fpassthru($fp);
// or...
echo file_get_contents($filepath);
?> 

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.