473,408 Members | 2,402 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

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 12717

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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: KanZen | last post by:
I'm trying to understand the difference between __setitem__ and an ordinary method. For example: >>> class A(object): def __getitem__(self, *args): print len(args) def normalMethod(self,...
66
by: Darren Dale | last post by:
Hello, def test(data): i = ? This is the line I have trouble with if i==1: return data else: return data a,b,c,d = test()
7
by: A. Saksena | last post by:
Hi all, Is it possible to write a function or a macro in C++, which is capable of accepting any number of arguments. To give an example, the following should be possible: - ...
6
by: Melkor Ainur | last post by:
Hello, I'm attempting to build an interpreter for a pascal-like language. Currently, I don't generate any assembly. Instead, I just build an abstract syntax tree representing what I've parsed...
21
by: dragoncoder | last post by:
Consider the following code. #include <stdio.h> int main() { int i =1; printf("%d ,%d ,%d\n",i,++i,i++); return 0; }
36
by: Pacific Fox | last post by:
Hi all, haven't posted to this group before, but got an issue I can't work out... and hoping to get some help here ;-) I've got a base object that works fine with named arguments when called...
7
by: mosfet | last post by:
Hi, I have a class defined like this : class CScreenLib { public: CScreenLib(void); ~CScreenLib(void);
6
by: CptDondo | last post by:
How do you declare a function with 0 or mroe arguments? I have a bunch of functions like this: void tc_cm(int row, int col); void tc_do(void); void tc_DO(int ln); and I am trying to ...
12
by: lorlarz | last post by:
In the code sample below, how are arguments a legitimate argument to Array.slice? Function.prototype.bind = function(){ var fn = this, args = Array.prototype.slice.call(arguments), object =...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.