View Full Version : Getting Variables from a forwarded page
03-05-2007, 08:36 PM
Hi, im looking to include a page in my php file, for example http://othersite.com/foward/15052 (I think its with Header("")), forwards the page to othersite.com?viewmovie=15052&tempid=10101505050550505&autostart=0
I need to get the address into my php page, but I dont know where to start with this.
I need to then break up the variables, I could probably do that with explode, but everytime I go to the forward page it will change the viewmovie variables, so I gotta make it dynamicly break up the variables on the spot.
If you can point me towards any commands or tutorials that would be great, thanks.
edit: you can close this, I found curl
03-05-2007, 10:58 PM
For future people who come by this thread...
To get the address into your page, you simply need to use $_GET to grab the key/value pairs. The key is the first part...it is the descriptive name of what the $_GET is. The value is self-evident...the value of the key. If your address is othersite.com/index.php?viewmovie=15052&tempid=10101505050550505&autostart=0 , you would do it like this:
$viewmovie = $_GET['viewmovie'];
$tempid = $_GET['tempid'];
$autostart = $_GET['autostart'];
Then, if you had a media player object on your page, you could just insert it in where you need it with a simplified echo:
<object width="425" height="350">
<param name="movie" value="http://www.mysite.com/<?=$viewmovie?>.wmv"></param>
This code won't work, but it gives you the picture. If this was not what your issue was, disregard.
03-05-2007, 11:01 PM
thats not what I was using for this job, Imight not have explained it very well but heres the code
// initialize a new curl resource
$ch = curl_init();
// set the url to fetch
curl_setopt($ch, CURLOPT_URL, 'http://www.youtube.com/v/tcxhOGyrCtI');
// don't give me the headers just the content
curl_setopt($ch, CURLOPT_HEADER, 1);
// return the value instead of printing the response to browser
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// use a user agent to mimic a browser
$useragent = $_SERVER['HTTP_USER_AGENT'];
curl_setopt($ch, CURLOPT_USERAGENT, $useragent);
$content = curl_exec($ch);
// remember to always close the session and free all resources
echo "curl library is not installed so we better use something else";
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.