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
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);
?> 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.