[PHP] - Video Leeching

Discussion in 'Scripts, 3rd Party Apps, and Programming' started by masterjake, Feb 21, 2009.

  1. masterjake

    masterjake New Member

    Messages:
    73
    Likes Received:
    0
    Trophy Points:
    0
    I'm creating a fun site where users can submit videos. I already know quite a bit of php but I'm having trouble thinking of a secure way to do this. I need it so that they can enter the url to the video and php will find the video on that page then set up an embed for it with the sizes I specify. Afterwards it will of course place the embed that was setup into the database along with all the other information i allow them to fill out like video title, description, tags and stuff and become viewable, browsable, and searchable on the site.

    Anyone know a way I could do the secure video sniffer thing?
     
  2. Parsa44

    Parsa44 New Member

    Messages:
    232
    Likes Received:
    0
    Trophy Points:
    0
    Bascily a spoof of YouTube....

    Well i suggest you use the PHP include command, for displaying the videos (in simple terms)

    User uploads video file $variable is created

    also page $variable is created which php script:
    <?php include("/videos/$user/$variable.php"); ?>

    As for the description tags, tittle i suggest something similar to above.

    Also for all the other things you said:
    http://www.w3schools.com/php/php_file_upload.asp

    EDIT: Add to my reputation if this is usefull to you!
     
    Last edited: Feb 21, 2009
  3. masterjake

    masterjake New Member

    Messages:
    73
    Likes Received:
    0
    Trophy Points:
    0
    no no no no, your missing my point. I already know how to do all of that, this isn't a site where people can UPLOAD videos this is just for them to leech stuff off youtube. While waiting I went and looked up some php stuff and found something on php DOM allowing php to visit a page and sniff out the embed code for the video which was what I was looking for. Having some problems getting some stuff working though right now.
     
  4. Scoochi2

    Scoochi2 New Member

    Messages:
    185
    Likes Received:
    0
    Trophy Points:
    0
    Use PHP to open the URL. Use file() or file_get_contents(), depending if you prefer to search through an array or a large string. This will give you the source of the page. Next, search for the string <input id="embed_code" name="embed_code" type="text" value="

    Save the rest of the line after that as a new variable. Search that new variable for a double quote (ie, a ") and strip that out and everything after it.
    Now all you need to do is to use htmlspecialchars_decode() on that string, and echo out the result.


    EDIT: if you do this correctly, that final string that you echo should look like the following (but obviously with a different video and so on!)
    HTML:
    <object width="425" height="344">
    <param name="movie" value="http://www.youtube.com/v/5Uk24lC3BUo&hl=en&fs=1"></param>
    <param name="allowFullScreen" value="true"></param>
    <param name="allowscriptaccess" value="always"></param>
    <embed src="http://www.youtube.com/v/5Uk24lC3BUo&hl=en&fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344">
    </embed></object>
    NOTE: I added in line breaks in the example code above. The actual result will all be on one line, with no whitespace.
     
    Last edited: Feb 21, 2009

Share This Page