关于POST方式传递数据的问题 php数据post 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 算我话没说清楚……我是希望在另一个专门的页面输出我的字符串,而不是在我提交POST请求的页面上我现在只是用php模拟POST请求,以后要变的就比如,我用一个C程序向某个URL提交了一个POST请求,传了个字符串过去然后我希望打开一个指定的页面,例如output.php,在这上面看到我程序传过去的字符串刚开始学php,可能post请求的用法我理解错了……但我的需求应该说清楚了,希望各位指教我该怎么做? 可以用數據庫或文件保存。a.php<?php$uri = "http://localhost/handle.php";// 参数数组$data = array ( 'name' => 'tanteng' // 'password' => 'password'); $ch = curl_init ();// print_r($ch);curl_setopt ( $ch, CURLOPT_URL, $uri );curl_setopt ( $ch, CURLOPT_POST, 1 );curl_setopt ( $ch, CURLOPT_HEADER, 0 );curl_setopt ( $ch, CURLOPT_RETURNTRANSFER, 1 );curl_setopt ( $ch, CURLOPT_POSTFIELDS, $data );$return = curl_exec ( $ch );curl_close ( $ch ); print_r($return);?>handle.php<?php$name = isset($_POST['name'])? $_POST['name'] : '';file_put_contents('tt.txt', $name, true);echo 'success';?>b.php<?phpecho 'this is the posted data';if(file_exists('tt.txt')){ $name = file_get_contents('tt.txt'); if(!empty($name)){ echo '您好,',$name.'!'; }}?> jquery post传值乱码?????? 问个简单问题 学php该从何学起? 求救:怎么在网站中实现paypal支付接口? date是弱智问题 copy的时候,一定要传完才能读到临时文件名$file吗? 如何把所有的双引号都替换成单引号?//如何把所有的回车都删除? 关于 array 请问:如何让IE解析php文件,具体该怎么配置php? php auto_prepend_file 关于换行的问题 PHP多图上传取值问题
我是希望在另一个专门的页面输出我的字符串,而不是在我提交POST请求的页面上
我现在只是用php模拟POST请求,以后要变的
就比如,我用一个C程序向某个URL提交了一个POST请求,传了个字符串过去
然后我希望打开一个指定的页面,例如output.php,在这上面看到我程序传过去的字符串
刚开始学php,可能post请求的用法我理解错了……但我的需求应该说清楚了,希望各位指教我该怎么做?
$uri = "http://localhost/handle.php";
// 参数数组
$data = array (
'name' => 'tanteng'
// 'password' => 'password'
);
$ch = curl_init ();
// print_r($ch);
curl_setopt ( $ch, CURLOPT_URL, $uri );
curl_setopt ( $ch, CURLOPT_POST, 1 );
curl_setopt ( $ch, CURLOPT_HEADER, 0 );
curl_setopt ( $ch, CURLOPT_RETURNTRANSFER, 1 );
curl_setopt ( $ch, CURLOPT_POSTFIELDS, $data );
$return = curl_exec ( $ch );
curl_close ( $ch );
print_r($return);
?>
handle.php<?php
$name = isset($_POST['name'])? $_POST['name'] : '';
file_put_contents('tt.txt', $name, true);
echo 'success';
?>
b.php<?php
echo 'this is the posted data';
if(file_exists('tt.txt')){
$name = file_get_contents('tt.txt');
if(!empty($name)){
echo '您好,',$name.'!';
}
}
?>