关于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.'!'; }}?> php编码问题,新手求教 变量可以在双引号的字符串中替换,可是为何表单域控件就不行呢? 请问like中文的问题 ajax 怎么生成多个radio按钮 PHP下mysql的text字段更新问题 还是HTML编辑器的问题。高手入!! 页面白屏一般是怎么了?怎么造成的? IMAPD有没有WIN版的? 在PHP里怎样得到当前服务器的路径,就象ASP里的Server.Path函数一样 分页提交通常是如何做的? 关于换行的问题 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.'!';
}
}
?>