Jump to content

challenging php/source code/video problem.. please help


Frankenkill

Recommended Posts

Hi phpfreaks  ;)

 

I've got a bit of a problem. I created a php page that retrieves the url to a videofile by checking a website's source code.

The php page works like a dream, but now comes the video part.

 

I want the URL of the video to be "echo'd" directly into my videoplayer. This works also.. but when I try to play the video.. it say's the videofile doesn't exists. This is the problem. The videofile does exist, because I've checked that, plus it is retrieved directly from the other website's source code.

 

My gues is that the video-url is echo'd wrong into the player (with special characters or something). I already checked this, but I can't find the problem!

 

Please take a look at my code and help me out! :) Thanks!!

 

<html>
<head>

<?php

$vidurl=$_GET['vid']; // dynamic URL to find the videofile on.
$contents = file_get_contents($vidurl); // retrieve source code

function get_string_between($string, $start, $end){ 
    $string = ' '.$string; 
    $ini = strpos($string,$start); 
    if ($ini == 0) return ''; 
    $ini += strlen($start); 
    $len = strpos($string,$end,$ini) - $ini; 
    return substr($string,$ini,$len); 
} 

$vidurl2=get_string_between($contents, '("file","', '");'); // strip code and store only the videofile into variable

?>
</head>
<body>
<?php
echo $vidurl2; // echo to check if the code is retrieved the correct URL. This works! so the file is retrieved correctly..
?>
<script type="text/javascript" src="swfobject.js"></script>
<script type="text/javascript">
	swfobject.registerObject("player","9.0.98","expressInstall.swf");
</script>

<object id="player" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" name="player" width="100%" height="100%">
	<param name="movie" value="player.swf" />
	<param name="allowfullscreen" value="true" />
	<param name="allowscriptaccess" value="always" />
	<param name="flashvars" value="file=<?php echo $vidurl2; ?>" />
	<object type="application/x-shockwave-flash" data="player.swf" width="100%" height="100%">
		<param name="movie" value="player.swf" />
		<param name="allowfullscreen" value="true" />
		<param name="allowscriptaccess" value="always" />
		<param name="flashvars" value="file=<?php echo $vidurl2; ?>" />
		<p><a href="http://get.adobe.com/flashplayer">Get Flash</a> to see this player.</p>
	</object>
</object>
</center>
</body>
</html>

 

[attachment deleted by admin]

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.