Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

i wanna pass these variables to another php file

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

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
bisihughes
New php-forum User
New php-forum User
 
Posts: 1
Joined: Mon Jan 14, 2013 7:19 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.
NigelRen
php-forum Active User
php-forum Active User
 
Posts: 450
Joined: Fri Aug 05, 2011 9:53 am


Return to PHP coding => General

Who is online

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

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron