I have a php file named test.php.In that file I have to take two inputs which are number and message.I wish to execute this php file from command prompt.The problem is that after executing the php file it should ask me for inputs but it isn't doing that.My code is below
echo "ENTER YOUR NUMBER";
$num = $_GET["number"];
echo "Enter your message";
$msg = $_GET["message"];
echo $num;
echo $msg;
Can someone help me with it?
My test.php file now contains the following code
echo "ENTER YOUR NUMBER";
$num = trim(fgets(STDIN));
echo "Enter your message";
$msg = trim(fgets(STDIN));
$post['num'] = $num;
$post['msg'] = $msg;
$url = 'http://172.16.1.223/source%20codes/wc.php';
$fields = array(
'num'=>urlencode($post["num"]),
'msg'=>urlencode($post["msg"])
);
$fields_string = http_build_query($fields);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_POST,count($fields));
curl_setopt($ch,CURLOPT_POSTFIELDS,$fields);
$response = curl_exec($ch)
I am trying to access another file wc.php which is on another computer through ip address and using curl.Problem is that I am not understanding in wc.php file is the input taking format is correct or not.wc.php file contains the following code
$num=trim(fgets(STDIN));
$msg=trim(fgets(STDIN));
echo $num;
echo $msg;
I just want to pass the variables from test.php to wc.php