function.fopen failed to open stream no such file or directory in php

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sleepybutterfly
    New Member
    • Jan 2013
    • 1

    function.fopen failed to open stream no such file or directory in php

    Hi,

    I've been work for file download at remote server by using fopen function but i get the error :

    Warning: fopen(/a/b/song.mp3) [function.fopen]: failed to open stream: No such file or directory

    Warning: curl_setopt(): supplied argument is not a valid File-Handle resource

    Warning: fclose(): supplied argument is not a valid stream resource


    My code as per below :

    Code:
    $url_128 = "/a/b/song.mp3";
    $url  = 'http://a.com:8080'.$url_128;
    $path = $url_128;
    		 
    $fp = fopen($path, 'w');
    		 
    $ch = curl_init($url);
    curl_setopt($ch, CURLOPT_FILE, $fp);
    		 
    $data = curl_exec($ch);
    		 
    curl_close($ch);
    fclose($fp);
    Last edited by Meetee; Jan 15 '13, 04:53 AM. Reason: Use code tags <code/> around code
Working...