Re: Re: Posting variables from one php script to another

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The below method is the way I send variables to the movieBuilder.php file [located in the 'src' attribute] with GET Variables
It does work :)

How would I use CURL to POST the same variables to the movieBuilder.php file WITHIN the 'src' attribute ?

FYI, I am able to POST to the movieBuilder.php file as the POSTed variables are properly echo'd when I look at the buffer I would assume it would not be much different than Posting variables to a GD script to create a dynamic image




////////////////////////////////////////////////////////
// With GET--Does Work
////////////////////////////////////////////////////////

// Build the XML file
$xml = <<<EOB
<?xml version="1.0"?>
<?quicktime type="application/x-quicktime-media-link"?>
<embed
src="./movieBuilder.php? mask=mask.gif&drag=drag.gif&movie=fonovisa.mov"/>
EOB;
}

// output  the QT movie
header('Content-Type: application/x-quicktimeplayer');
header ("Content-Length:".strlen($xml));
echo $xml;


////////////////////////////////////////////////////////
// With POST
////////////////////////////////////////////////////////
// Build the XML file
$xml = <<<EOB
<?xml version="1.0"?>
<?quicktime type="application/x-quicktime-media-link"?>
<embed
src="SOMEHOW CALL THE 'CURLME' FUNCTION"/>
EOB;
}

// output the QT movie
header('Content-Type: application/x-quicktimeplayer');
header ("Content-Length:".strlen($xml));
echo $xml;

Function curlme(){
$ch = curl_init ("path2myScript/movieBuilder.php");
curl_setopt ($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_POST,1);
curl_setopt ($ch, CURLOPT_POSTFIELDS, "mask=mask.gif&drag=drag.gif&movie=fonovisa.mov");
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
$buffer = curl_exec($ch); // execute the post
//echo $buffer;
curl_close ($ch);
}

anyone know how to do this ?
Is it too complicated to be worth it ?
I just want to avoid GET when  possible

many thanks
g





On Sep 23, 2005, at 5:57 AM, Jasper Bryant-Greene wrote:

Al wrote:
I'd use this. It's simple and doesn't involve CURL. Here is a brief outline.
$file_str= base64encode(serialize($_GET));  //$_GET can be any array

Any reason why you base64_encode here? fwrite is binary-safe so base64 encoding your data is slow and a waste of space.

Create a temporary file and write your string
fwrite($temp, $file_str);
fetch your data with
$saved_get= unserialize(base64decode(file_get_contents(filename));
Unlink your file when done with it.

Rather than resort to the slow process of creating, writing, reading and deleting a file for every request (not to mention generating a unique ID to prevent collisions with simultaneous requests), I'd be more tempted to find out exactly why the OP couldn't get it working with GET variables.

Perhaps he could post some more code, as I regularly pass GET variables to PHP scripts through <img> tags and the like with no problems whatsoever.

--
Jasper Bryant-Greene
Freelance web developer
http://jasper.bryant-greene.name/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux