Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Sep 2006
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Getting Variables from a forwarded page

    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
    Last edited by blazing; 03-05-2007 at 09:27 PM. Reason: found curl

  • #2
    Super Moderator JohnDubya's Avatar
    Join Date
    Nov 2006
    Location
    Missouri
    Posts
    634
    Thanks
    12
    Thanked 18 Times in 18 Posts
    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:

    PHP Code:
    $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:

    PHP Code:
    <object width="425" height="350">
    <embed autostart="<?=$autostart?>">
    <param name="movie" value="http://www.mysite.com/<?=$viewmovie?>.wmv"></param>
    </embed>
    </object>
    This code won't work, but it gives you the picture. If this was not what your issue was, disregard.

  • #3
    New to the CF scene
    Join Date
    Sep 2006
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thats not what I was using for this job, Imight not have explained it very well but heres the code

    Code:
    if (function_exists('curl_init'))
    {
    	// 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
    	curl_close($ch);
    	echo $content;
    }
    else
    {
    	echo "curl library is not installed so we better use something else";
    }


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •