need some direction...

Discussion in 'PHP' started by cavendano, Apr 10, 2008.

  1. #1
    would php be able to handle file receiving from another site?
    this is what i want to do i want users to input a lets say an audio file and have it converted it to a different file..the file conversion should not be a problem but the problem is getting the script to know when it should start converting.

    so lets say a user wants a .wav file from somewavfilesite.com/mywav.wav and he puts the link to the site on my script... how would the script know how large the file is and when to start converting it into mp3?
     
    cavendano, Apr 10, 2008 IP
  2. c4st

    c4st Peon

    Messages:
    41
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Well if your site is doing the converting, it has to download the wav. Once you download the wav to your sever, you can use PHP's file_size() function. When converting, I'm pretty sure you start at byte 1... I don't see why you would need to know the start position.
     
    c4st, Apr 10, 2008 IP
  3. cavendano

    cavendano Well-Known Member

    Messages:
    360
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    130
    #3
    <?
    $uri = "http://afakesitethathaswav.com/wav.wav";
    $contents = file_get_contents($uri);
    $f=@fopen("dump.wav","a");
    fwrite($f,$contents);
    fclose($f);
    echo "done";
    ?>
    
    Code (markup):
    ok let me see if i can start from step 1..which is getting the file from a remote server to my server..i already have it where the user can upload a file but a remote server upload is what i want...
    i cant seem to get this to work...its not downloading the file from a remote server and saving it on my server...
     
    cavendano, Apr 10, 2008 IP