因为php只能在本服务器传值 并且受到目录的限制  所以要跨服务器传值会很麻烦  有几个方法 现在用过的有两个

 

一 写成html然后利用js直接post过去

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>无标题文档</title>
</head>
<body>
<form name="mainform" id="mainform" action="&lt;?php echo $lbsurl ?>/account2.php" method="post" encType="multipart/form-data"&gt;
<input type="hidden"  name="serviceflag" maxLength=60 size=40 value="&lt;?php echo $serviceflag ?>" /&gt;
<input type="hidden"  name="servicetime" maxLength=60 size=40 value="&lt;?php echo $servicetime ?>" /&gt;
<input type="hidden"  name="user" maxLength=60 size=40 value="&lt;?php echo $user ?>" /&gt; 
<input type="hidden"  name="sim" maxLength=60 size=40 value="&lt;?php echo $sim ?>" /&gt; 
<input type="hidden"  name="password" maxLength=60 size=40 value="&lt;?php echo $password ?>" /&gt;
<input type="hidden"  name="imei" maxLength=60 size=40 value="&lt;?php echo $imei ?>" /&gt;
<div style="display:none"><input type="submit" name="event_submit_do_edit" value="" /></div>
<script language="JavaScript" type="text/JavaScript">
var mainform = document.getElementById("mainform");
mainform.submit()
</script>
</form>
   </body>
</html>

二 curl 开启一个会话  curl既可以传值 也可以请求页面 这个就是传值  然后得到结果

//这个curl很强大能做很多事情  远程下载文件也可以

﹤?php 
$phoneNumber = '13912345678'; 
$message = 'This message was generated by curl and php'; 
$curlPost = 'pNUMBER='  . urlencode($phoneNumber) . '&MESSAGE=' . urlencode($message) . '&SUBMIT=Send'; 
$ch = curl_init(); 
curl_setopt($ch, CURLOPT_URL, 'http://www.example.com/sendSMS.php');
curl_setopt($ch, CURLOPT_HEADER, 1); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
curl_setopt($ch, CURLOPT_POST, 1); 
curl_setopt($ch, CURLOPT_POSTFIELDS, $curlPost); 
$data = curl_exec(); 
curl_close($ch); 
?﹥ 

另一个post

<?php
// create a new curl resource
$ch = curl_init();
// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL,”http://projects/phpit/content/using%20curl%20php/demos/handle_form.php”);
// Do a POST
$data = array(’name’ => ‘Dennis’, ’surname’ =&gt; ‘Pallett’);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
// grab URL, and print
curl_exec($ch);
?&gt;

这是请求数据

﹤?php 
// 初始化一个 cURL 对象 
$curl = curl_init();  
// 设置你需要抓取的URL 
curl_setopt($curl, CURLOPT_URL, 'http://cocre.com');
// 设置header 
curl_setopt($curl, CURLOPT_HEADER, 1); 
// 设置cURL 参数,要求结果保存到字符串中还是输出到屏幕上。 
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); 
// 运行cURL,请求网页 
$data = curl_exec($curl); 
// 关闭URL请求 
curl_close($curl); 
// 显示获得的数据 
var_dump($data);