开发者

Sending data between sites

开发者 https://www.devze.com 2023-01-31 17:01 出处:网络
What is a good method to send data from site A to site B without passing a new URL parameter? For instance, on site A I submit apples are red via a form. How can I send that data to site B without m

What is a good method to send data from site A to site B without passing a new URL parameter?

For instance, on site A I submit apples are red via a form. How can I send that data to site B without modifying site B's URL structure?

example http://siteb.com/?data=apples+are+red

Not sure if trackbacks or pingbacks use a开发者_开发技巧 similar method.


if you're just trying to submit the form directly to siteb, simply use method="get" and action="http://siteb.com"

lets say you are sending an offset where siteb will use it to determine a page number from an arcticles listing, your form on sitea would be something like:

<form method="get" action="http://siteb.com">
  <input type="text" name="offset" id="offset" value="0" />
  <input type="submit" value="OK" />
</form>


The query string, like your example above, but siteb needs to know what data its getting.

Think of it like the affiliate programs, where you pass a linke to siteb (in this case the affiliate site) from your sitea via the query string, it works because site b knows what to expect.


you mean like:

$data = 'http://siteb.com?'.$_SERVER['QUERY_STRING'];
$ch = curl_init($data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_exec($ch);
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号