script help

  • javacode
  • Born
  • Born
  • javacode
  • Posts: 3

Post 3+ Months Ago

Zshare code

Hi Guys i am trying to pull zshare videos on my site ... tried a lot
but comes under failure .. if any one can figure it out ... i have paste a sample code ...

sample code if any one can figure it out and share with me !

Code: [ Select ]
<?php
function ValidateID($ID='')
{
return preg_match('#^[0-9a-z]{1,10}$#i',$ID);
}

$MovieID = $_REQUEST['id'];
if(ValidateID($MovieID))
{ //Only show if the ID is valid to prevent injection
?>
<iframe style='margin-top: 420px' onLoad='window.scrollTo(6,532)' src ='http://www.zshare.net/video/?v=<?php echo $MovieID; ?>' width='1000' height='1000' vspace='0' hspace='0' allowtransparency='true' scrolling='no' marginwidth='0' marginheight='0' frameborder='0' style='border:0px;'></iframe>
<?php
}
  1. <?php
  2. function ValidateID($ID='')
  3. {
  4. return preg_match('#^[0-9a-z]{1,10}$#i',$ID);
  5. }
  6. $MovieID = $_REQUEST['id'];
  7. if(ValidateID($MovieID))
  8. { //Only show if the ID is valid to prevent injection
  9. ?>
  10. <iframe style='margin-top: 420px' onLoad='window.scrollTo(6,532)' src ='http://www.zshare.net/video/?v=<?php echo $MovieID; ?>' width='1000' height='1000' vspace='0' hspace='0' allowtransparency='true' scrolling='no' marginwidth='0' marginheight='0' frameborder='0' style='border:0px;'></iframe>
  11. <?php
  12. }
Moderator Remark: Added [code] tags
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • UPSGuy
  • Lurker ಠ_ಠ
  • Web Master
  • User avatar
  • Posts: 2733
  • Loc: Nashville, TN

Post 3+ Months Ago

Do you have an example of what you're passing in as id and what you're hoping to extract?
  • javacode
  • Born
  • Born
  • javacode
  • Posts: 3

Post 3+ Months Ago

Hi i just neeed a help on zshare code like i want to play zshare videos on my site
  • UPSGuy
  • Lurker ಠ_ಠ
  • Web Master
  • User avatar
  • Posts: 2733
  • Loc: Nashville, TN

Post 3+ Months Ago

Ahh, so you mean that you want to plug the videos into your own site. I think I see now.

I messed with the code, what you're trying to do here won't work with valid zShare video sites. If you enter an incorrect address, zShare's 404 behaves as expected - it loads in the iframe & positions itself correctly, however, when I tried it with an actual ID, their page broke out of the iFrame.

These two lines of Javascript that they include on their videos pages are what's making their page break out.
JAVASCRIPT Code: [ Select ]
 
if (top != self) {
 top.location = self.location;
 
  1.  
  2. if (top != self) {
  3.  top.location = self.location;
  4.  


You won't be able to load their pages into iframes. You're going to need a different approach to the matter, and I'm not entirely sure that you can load their videos directly, either. There's a pretty hairy bit of logic they're using to obfuscate their video links.

EDIT: Afterthought - You could do this by capturing the response stream, parsing out what you want, and using the result.
  • UPSGuy
  • Lurker ಠ_ಠ
  • Web Master
  • User avatar
  • Posts: 2733
  • Loc: Nashville, TN

Post 3+ Months Ago

I consider this a learning post, I saw something that got my brain moving, so I had to do the code - I am not endorsing this method. Do NOT use this code without consent from the video owner(s).

Set up the form and submit an ID:
Code: [ Select ]
 
<html>
<head>
<title></title>
</head>
<body>
<form action="test.php" method="get">
    <input type="text" name="id" size="20" length="20" value="" />
    <br />
    <input type="submit" value="submit" />
</form>
</body>
</html>
 
  1.  
  2. <html>
  3. <head>
  4. <title></title>
  5. </head>
  6. <body>
  7. <form action="test.php" method="get">
  8.     <input type="text" name="id" size="20" length="20" value="" />
  9.     <br />
  10.     <input type="submit" value="submit" />
  11. </form>
  12. </body>
  13. </html>
  14.  


Parse & display video based on ID (note the change to the pattern - all the id's I saw were 14 digits):
PHP Code: [ Select ]
 
<?php
 
// note that this code presumes that a host site uses the format of:
// [h]ttp://www.someVideoHostAddress.net/video/1947d20fe83a19 (14 digit/letter mix)
 
function ValidateID($ID='')
{
     return preg_match('#^[0-9a-z]{14}$#i',$ID);
}
 
$MovieID = $_REQUEST['id'];
$bool = ValidateID($MovieID);
if(ValidateID($MovieID))
{
    //pull in the source of the target video page
    $url = "http://www.someVideoHostAddress.net/video/".$MovieID;
    $stream = file_get_contents($url); 
   
    //extract the object tag from the source code
    $pattern = '/(<object[^>]*?>(?:[\s\S]*?)<\/object>)/si';
    $result = preg_match($pattern, $stream, $matches);
   
    //convert relative paths to absolute
    $out = $matches[0];
    $out = str_replace("name=\"URL\" value=\"", "name=\"URL\" value=\"http://www.someVideoHostAddress.net/", $out);
    $out = str_replace("name=\"Player\" src=\"", "name=\"Player\" src=\"http://www.someVideoHostAddress.net/", $out);
?>
<html>
<head>
<title></title>
</head>
     <body>
          <?php echo $out; ?>
     </body>
</html>
<?php
}
?>
 
  1.  
  2. <?php
  3.  
  4. // note that this code presumes that a host site uses the format of:
  5. // [h]ttp://www.someVideoHostAddress.net/video/1947d20fe83a19 (14 digit/letter mix)
  6.  
  7. function ValidateID($ID='')
  8. {
  9.      return preg_match('#^[0-9a-z]{14}$#i',$ID);
  10. }
  11.  
  12. $MovieID = $_REQUEST['id'];
  13. $bool = ValidateID($MovieID);
  14. if(ValidateID($MovieID))
  15. {
  16.     //pull in the source of the target video page
  17.     $url = "http://www.someVideoHostAddress.net/video/".$MovieID;
  18.     $stream = file_get_contents($url); 
  19.    
  20.     //extract the object tag from the source code
  21.     $pattern = '/(<object[^>]*?>(?:[\s\S]*?)<\/object>)/si';
  22.     $result = preg_match($pattern, $stream, $matches);
  23.    
  24.     //convert relative paths to absolute
  25.     $out = $matches[0];
  26.     $out = str_replace("name=\"URL\" value=\"", "name=\"URL\" value=\"http://www.someVideoHostAddress.net/", $out);
  27.     $out = str_replace("name=\"Player\" src=\"", "name=\"Player\" src=\"http://www.someVideoHostAddress.net/", $out);
  28. ?>
  29. <html>
  30. <head>
  31. <title></title>
  32. </head>
  33.      <body>
  34.           <?php echo $out; ?>
  35.      </body>
  36. </html>
  37. <?php
  38. }
  39. ?>
  40.  
  • javacode
  • Born
  • Born
  • javacode
  • Posts: 3

Post 3+ Months Ago

Hi Ups Guy i have sucessfull made the zshare script ... ! thx 4 the help .. i need some small help , see this url http://alex4u.ulmb.com/zs/movies.php?ur ... 0ff58cf17/ , i have made like this site .. but i got failure on like , If this video is not working, click here to watch it, example:http://ourhostsite.com/zs/wmv.php?url= {some code missing }see like when u enter this site http://alex4u.ulmb.com/zs/movies.php?ur ... 0ff58cf17/ , u can scroll down and when u click on If this video is not working, click here to watch it .. u can see the same id that number .. i need to know how to bring them ...!
  • thelesabre
  • Born
  • Born
  • thelesabre
  • Posts: 1

Post 3+ Months Ago

UPSGuy I tried using the php code but I cant seem to figure out how to get it working. I added the correct URL in the php code and pasted the correct video id and when it goes from the test.php page its a white page with no video. what am I doing wrong?
  • toothpick
  • Born
  • Born
  • toothpick
  • Posts: 2

Post 3+ Months Ago

how will i use this php?
  • toothpick
  • Born
  • Born
  • toothpick
  • Posts: 2

Post 3+ Months Ago

zshare change their script and this will not work anymore please help to crack new script..

Post Information

  • Total Posts in this topic: 9 posts
  • Users browsing this forum: No registered users and 56 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.