php help needed

Discussion in 'PHP' started by muts, Aug 16, 2009.

  1. #1
    this script working fine but for some reason stop to work .

    this script for zshare to Embedded video ,

    <?php
    
    $sData = file('http://www.zshare.net/video/'.$_REQUEST['movie']);
    
    foreach ($sData as $line_num => $sData) {
    if(strstr(htmlspecialchars($sData), "zshare.net/stream/")){
    $result = htmlspecialchars($sData);
    }    
    }
    $start = strpos($result,"http");
    $end = strpos($result,".mp4");
    if(!$end){
    $end = strpos($result,".flv");
    }
    $path = substr($result,$start,$end);
    $path = split("'", $path);
    $sURL = $path[0];
     
    
    
    				$sEmbedCode = "<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase="			
    				."'http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' width='100%' height='100%' id='player'>"
    						."<param name='movie' value='backup.swf' />"
    						."<param name='FlashVars' value='videos=".$sURL."' />"
    						."<param name='allowfullscreen' value='true' />"
    						."<embed src='backup.swf' FlashVars='videos=".$sURL."' width='100%' height='100%' name='player'"
    						." type='application/x-shockwave-flash' allowfullscreen='true' pluginspage='http://www.macromedia.com/go/getflashplayer' />"
    					."</object>";
    
    ?>
    <html>
        <head>
            <title></title>
        </head>
    <script type="text/javascript">
    
    function light_manager(index, strength){
    if(index == 0){
    parent.dim_lights(strength)
    }else{
    parent.raise_lights(strength)
    }
    }
    
    </script>
        <body>
        	<?php
    
        		echo $sEmbedCode;
    
        	?>
        </body>
    </html> 
    PHP:

    any help ?
     
    muts, Aug 16, 2009 IP
  2. kblessinggr

    kblessinggr Peon

    Messages:
    539
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    0
    #2
    file() might not be the best function to use since some hosts do not allow file() or file_get_contents() but rather can use curl.

    IF you have shell access, try SSHing into your server and doing

    wget http://www.theurlyouwantograb.com

    There might be a chance that your server got blocked from accessing them.
     
    kblessinggr, Aug 16, 2009 IP
  3. premiumscripts

    premiumscripts Peon

    Messages:
    1,062
    Likes Received:
    48
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Just try an echo after the first line to see if it can grab the data correctly:

    echo $sData;
    PHP:
    If it doesn't, you can just change the first line to this: (PHP5)

    $sData = file_get_contents('http://www.zshare.net/video/'. urlencode($_REQUEST['movie']));
    PHP:
     
    premiumscripts, Aug 16, 2009 IP
  4. premiumscripts

    premiumscripts Peon

    Messages:
    1,062
    Likes Received:
    48
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Actually, it's most likely that the site (zshare) has changed it's HTML. If you can supply a sample link it would be easier to tell.
     
    premiumscripts, Aug 16, 2009 IP
  5. muts

    muts Peon

    Messages:
    10
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    this is what i use , i just embed this line in my page

    <iframe class="iframeswf" height=464 width=900 scrolling=no frameborder=0 src="/ZS2.php?6395865166b77eaf">
    PHP:

    this is the id for the video > 6395865166b77eaf

    and it was working fine ,
     
    muts, Aug 16, 2009 IP
  6. premiumscripts

    premiumscripts Peon

    Messages:
    1,062
    Likes Received:
    48
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Shouldn't that be ZS2.php?movie=xxxxxxxx
     
    premiumscripts, Aug 16, 2009 IP
  7. premiumscripts

    premiumscripts Peon

    Messages:
    1,062
    Likes Received:
    48
    Best Answers:
    0
    Trophy Points:
    0
    #7
    You may want to try this instead:

    
    if (preg_match('/http:\/\/[^\.]+\.zshare\.net\/stream\/[a-z0-9\.\/\-\_]+\.(mp4|flv)/i', $contents, $match)) {
    	$sURL = $match[0];
    } else {
          $sURL = '';
    }
    
    PHP:
     
    premiumscripts, Aug 16, 2009 IP
  8. muts

    muts Peon

    Messages:
    10
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    what should i use im my html page ?

    <iframe class="iframeswf" height=464 width=900 scrolling=no frameborder=0 src="/ZS2.php?6395865166b77eaf">
    PHP:

    or

    <iframe class="iframeswf" height=464 width=900 scrolling=no frameborder=0 src="/ZS2.php?movie=6395865166b77eaf"></iframe>
    PHP:
     
    muts, Aug 16, 2009 IP
  9. muts

    muts Peon

    Messages:
    10
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #9
    the script in the root , and my page inside some folder ,
     
    muts, Aug 16, 2009 IP
  10. muts

    muts Peon

    Messages:
    10
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #10

    I tray that but it does not work ,

    <?php
    $bDebug = isset($_GET['debug']) ? true : false;
    if( ! $bDebug)
    {
    	ob_start();
    }
    
    function getZShareVideoURL($sVideoID)
    {
    	if($sData = file_get_contents('http://www.zshare.net/video/'.$sVideoID))
    	{
    		if(1 === preg_match('~(http://[^.]+.zshare.net/stream/[^.]+\\..{3})~i', $sData, $aMatch))
    		{
    			return $aMatch[0].'?'.rand(1000000, 9999999);
    		}
    	}
    	return false;
    }
    
    $sEmbedCode = false;
    
    if(isset($_GET['movie']) && !empty($_GET['movie']))
    {
    	if($sURL = getZShareVideoURL($_GET['movie']))
    	{
    		switch (strtolower(substr($sURL, -3, 3)))
    		{			
    			#Insert incompatible types here.
    			case 'exe':
    			case 'msi':
    			break;
    			
    			default:
    				$sEmbedCode = sprintf(
    					'<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="100%%" height="100%%" id="player">
    						<param name="movie" value="backup.swf" />
    						<param name="FlashVars" value="videos=%s" />
    						<param name="allowfullscreen" value="true" />
    						<embed src="backup.swf" FlashVars="videos=%s" width="100%%" height="100%%" name="player" type="application/x-shockwave-flash" allowfullscreen="true" pluginspage="http://www.macromedia.com/go/getflashplayer" />
    					</object>',
    					$sURL,
    					$sURL
    				);
    			break;
    		}
    	}
    }
    if( ! $bDebug)
    {
    	ob_end_clean();
    }
    ?>
    <html>
        <head>
            <title></title>
        </head>
        <body>
        	<?php
        	if($sEmbedCode !== false)
        	{
        		echo $sEmbedCode;
        	}
        	else
        	{
        		echo '<p>Sorry, that video is currently unavailable.</p>';
        	}
        	?>
        </body>
    </html>
    
    
    PHP:
     
    muts, Aug 16, 2009 IP
  11. muts

    muts Peon

    Messages:
    10
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #11
    I will pay for something work with flv files , No PAYPAL please , any other payments Company will be nice
     
    muts, Aug 16, 2009 IP