i wanna pass these variables to another php file

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

bisihughes
New php-forum User
New php-forum User
Posts: 1
Joined: Mon Jan 14, 2013 7:19 am

i wanna pass these variables to another php file

Postby bisihughes » Mon Jan 14, 2013 7:28 am

ok please take a look at this


$i=0;
while ($i < 10)

{
$Variable1 = $1;
$Variable2 = "Hello";

/* i wanna pass these variables to another php file
say "http://localhost/reveiver.php

Once the variables are recieved in the receiver.php, its gonna pass them to an sms gateway

header('Location: http://www.address.com/file.php?var1 = ' . $Variable1 . '&var2=' . $Variable2 '); */



$i++;
}



the problem i am facing is that, after the first set of variables is gone, the header function overrides the existing
hence the rest of the loop does not get to execute

is there a way out with php alone?

am quite new at this...
thanx

NigelRen
php-forum Active User
php-forum Active User
Posts: 450
Joined: Fri Aug 05, 2011 9:53 am

Re: i wanna pass these variables to another php file

Postby NigelRen » Wed Jan 16, 2013 6:59 am

What you are doing is effectively moving to another page, you need to use something like CURL to 'call' another page. The code on http://php.net/manual/en/function.curl-exec.php should give you a starting point.


Return to “PHP coding => General”

Who is online

Users browsing this forum: Google [Bot] and 1 guest

cron