469,351 Members | 1,814 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,351 developers. It's quick & easy.

Including PHP arguments in... PHP Argument

I know the subject is a bit confusing, but I really need to know if
this is possible.

I've got a php page. Let's call that a.php In a.php, I make a call to
a webpage (b.php), with some arguments
(http://domain.com/b.php?abcd=1234&efgh=5678).

Can I do something like this:

http://domain.com/a.php?argument='abcd=1234&efgh=5678', then from a.php
use $_GET['argument'] to use in the creation of the URL to call b.php?

In other words, I want to include a php argument in a php argument.

Is this possible?

I'd prefer not to use seperate variables (i.e.
http://domain.com/a.php?abcd=1234&efgh=5678) to forward it to b.php,
but if it's not possible, I guess I'll have to.

Thanks,
iw****@gmail.com

Aug 29 '05 #1
6 12452

I'd prefer not to use seperate variables (i.e.
http://domain.com/a.php?abcd=1234&efgh=5678) to forward it to b.php,
but if it's not possible, I guess I'll have to.

Thanks,
iw****@gmail.com


What you are trying to do is called 'indirection' in other languages

i.e.

$varb='$a=20';
execute $varb;
echo $a;

Result in '20' showing on the screen

However I do not have enough knowledge to know if it is possible in php to
do this.

Sorry - googlin for 'php' and 'indirection' is throwing up a blank...

it might be called somthing else in PHP.

Aug 30 '05 #2
jay
try using urlencode() function on the second url. look it up on the
php manual.

ex:
$argument = urlencode(abcd=$_GET['abcd']&efgh=$_GET['efgh']);

then pass it to the second url

http://domain.com/a.php?argument=$argument

however you have to split the argument parameter to get the data.

have used this before, got not much idea on its complications though.

Aug 30 '05 #3
OK, you answered half my question (thanks for the quick response),

but now does anybody know if you can do something like
http://www.domain.com/a.php?arg='$a=32&b=63'

Aug 30 '05 #4
NC
IW****@gmail.com wrote:

Can I do something like this:

http://domain.com/a.php?argument='abcd=1234&efgh=5678', then from a.php
use $_GET['argument'] to use in the creation of the URL to call b.php?


Yes. In scripts linking to a.php, you can write:

$link = 'http://domain.com/a.php?argument=' .
urlencode('abcd=1234&efgh=5678');
echo "<a href='$link'>Click here for a.php...</a>";

Then in a.php, you can write, for example:

$b = file_get_contents('http://domain.com/b.php?' .
urldecode($_GET['argument']));

Cheers,
NC

Aug 30 '05 #5
*** IW****@gmail.com wrote/escribió (29 Aug 2005 16:01:11 -0700):
http://domain.com/a.php?argument='abcd=1234&efgh=5678', then from a.php
use $_GET['argument'] to use in the creation of the URL to call b.php?

In other words, I want to include a php argument in a php argument.

Is this possible?

I'd prefer not to use seperate variables (i.e.
http://domain.com/a.php?abcd=1234&efgh=5678) to forward it to b.php,
but if it's not possible, I guess I'll have to.


www.php.net/rawurlencode

I suppose the real files do not belong to the same website, otherwise it
wouldn't make much sense to use HTTP to access a file that is reachable
through the file system.
--
-- Álvaro G. Vicario - Burgos, Spain
-- http://bits.demogracia.com - Mi sitio sobre programación web
-- Don't e-mail me your questions, post them to the group
--
Aug 30 '05 #6
If Alvaro is saying is true for your case then its not possible..
If Alvaro is not true then explain in simple way

KERUL
[ProDesignZ]

Aug 30 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by KanZen | last post: by
66 posts views Thread by Darren Dale | last post: by
7 posts views Thread by A. Saksena | last post: by
21 posts views Thread by dragoncoder | last post: by
36 posts views Thread by Pacific Fox | last post: by
7 posts views Thread by mosfet | last post: by
6 posts views Thread by CptDondo | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by suresh191 | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.