scarhand Posted December 10, 2010 Share Posted December 10, 2010 I have this code: <?php $item_name = urlencode('product name'); $payment_amount = urlencode('20.00'); $payer_email = urlencode('[email protected]'); $getvars = "?item_name=$item_name&payment_amount=$payment_amount&payer_email=$payer_email"; include "http://www.mysite.com/ipn.php$getvars"; ?> It only seems to be passing $item_name, the other 2 variables come up as being set, but are empty. Link to comment https://forums.phpfreaks.com/topic/221229-_get-variables-in-include/ Share on other sites More sharing options...
requinix Posted December 10, 2010 Share Posted December 10, 2010 If using http_build_query doesn't fix it, the problem is using the wrong URL variables - either in that code or your ipn.php. In general, don't include your own PHP scripts like that. Don't use http://www.mysite.com. Include the file as it exists on your server - where it is on the hard drive. No URL arguments. Just the filename. Instead of the URL you can just define $_GET appropriately. $_GET = array( "item_name" => "product name", "payment_amount" => "20.00", "payer_email" => "[email protected]" ); include "ipn.php"; ?> Link to comment https://forums.phpfreaks.com/topic/221229-_get-variables-in-include/#findComment-1145415 Share on other sites More sharing options...
MMDE Posted December 10, 2010 Share Posted December 10, 2010 if you run this: <?php $item_name = urlencode('product name'); $payment_amount = urlencode('20.00'); $payer_email = urlencode('[email protected]'); $getvars = "?item_name=$item_name&payment_amount=$payment_amount&payer_email=$payer_email"; echo $getvars; ?> you get this: ?item_name=product+name&payment_amount=20.00&payer_email=me%40email.com is that the GET data you expect to add to the included page? Link to comment https://forums.phpfreaks.com/topic/221229-_get-variables-in-include/#findComment-1145417 Share on other sites More sharing options...
scarhand Posted December 10, 2010 Author Share Posted December 10, 2010 The problem is the included IPN file has to be on another server, which is why I'm referencing it as such. Yes - that is the GET data I'm trying to pass to the remote IPN file. Link to comment https://forums.phpfreaks.com/topic/221229-_get-variables-in-include/#findComment-1145461 Share on other sites More sharing options...
MMDE Posted December 10, 2010 Share Posted December 10, 2010 please provide the actual page that you want to include! Link to comment https://forums.phpfreaks.com/topic/221229-_get-variables-in-include/#findComment-1145511 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.