Jump to content

daljeetseni

New Members
  • Posts

    2
  • Joined

  • Last visited

daljeetseni's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi thanks for reply, here is my code, with file_get_contents which work perfectly for files with extensions like .pdf, .mp3 e.t.c, error_reporting(E_ALL); ini_set('display_errors', 1); $url =urldecode(trim($_POST['url'])); $content = file_get_contents($url); $name=basename($url); $fp = fopen($name, "w"); fwrite($fp, $content); fclose($fp); echo "<a href='".$name."'>".$name."</a>"; and here is the curl code: error_reporting(E_ALL); ini_set('display_errors', 1); $source = "http://website/file.php?id=123"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $source); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_SSLVERSION,3); $data = curl_exec ($ch); $error = curl_error($ch); curl_close ($ch); $destination = "test.mp3"; $file = fopen($destination, "w+"); fputs($file, $data); fclose($file); In case of loading the curl script, it does not give any error, but writes a 0 byte file named test.mp3 what i want is, the code should work even for files which are not having extension meaning, which are called by id like for example, http://website/file.php?id=123 so, i want to load this type of url in php script which can grab the file, if that is possible .
  2. Hi, I am trying to save an external file on my server which is like http://website.com/download.php?id=55134 file_get_contents does not work neither curl works, basically, this page should be loaded and then this id will be called, On my server exec command is disabled. so any other way, i can do this ? Thanks. Daljeet
×
×
  • 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.