My first.php file
$statusString = "u=10000;t1=1479409;s=10;r=-33;v=3.68;";
$macaddress= "10000";
$url = 'second.php';
$fields = array(
'newFormat'=>urlencode($statusString),
'MACAddress'=>urlencode($macaddress)
);
$fields_string = '';
foreach($fields as $key=>$value)
{
$fields_string .= $key.'='.$value.'&';
}
rtrim($fields_string,'&');
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL, $url);
curl_setopt($ch,CURLOPT_POST, count($fields));
curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string);
$result = curl_exec($ch);
curl_close($ch);
Here I am trying to send data from my first.php to my second.php
My second.php file
if (isset($_GET['newFormat']))
{
$str = $_GET['newFormat'];
}
else
$str = 'no data';
if (isset($_GET['MACAddress']))
{
$macAddress = $_GET['MACAddress'];
}
Here I am trying to retrieve the data sent by first.php.
My first.php invokes second.php, but second.php cannot retrieve any data. In my second.php, $str turn out to be 'no data' as in the the else part and $macAddress is empty! Can anyone please help me solve this?