有些联盟只允许填入一个tracker的post back url,这对于同时使用好几个tracker的话实在是不方便,因此我想使用中转的办法,一个中转服务器收到联盟的postback url,然后再把track.php?subid=XXXX(以imobitrax为例)转发到其它几个tracker上,自己捣鼓了一下没成功,有人帮忙看看问题在哪吗?' w2 \+ t3 D! H& E
% N! O% k9 d4 b3 |2 @( T2 s
<?php $subid=$_POST["subid"]; ?>
* w1 X/ Y! ?- _- \# b<?php( n& k& b7 x( w2 f8 |! T
function send_post($url, $post_data) {
& r. `2 E/ d7 U
! n( `& Y; m+ j1 ~. ^ $postdata = http_build_query($post_data);
e3 B, C D d/ F $options = array( 3 H7 v% F' H' d* x- u1 S3 J
'http' => array(
- P: W5 ^; j( p3 p& P1 ] 'method' => 'POST', + v! s9 ^: ?; w
'header' => 'Content-type:application/x-www-form-urlencoded', . @7 U; x+ k5 E9 Y8 L" T- C
'content' => $postdata,
) E; c: m3 X8 Y4 h- Z 'timeout' => 15 * 60 // 超时时间(单位:s)
3 h+ Y* }) Q& P9 V! i: H; J ) - P- N4 x, }2 y# R8 b0 j
);
+ k1 w7 k; V" S/ ^- H; g $context = stream_context_create($options);
: n# x( ^. G n+ Q: Q9 H $result = file_get_contents($url, false, $context); 2 e7 n5 y' _1 M s
7 H* h+ |6 T' C0 J return $result;
1 O8 j5 E2 N# t: ?! ]; z' x6 t}
# z4 @: u) z+ O1 {* `; z3 q' Y# R4 t7 @: q$ [
//使用方法
9 c0 X/ s- Z x. ^4 d' ~$post_data = array( $ ?; W7 b5 T& v6 C* ?& C
'subid' => $subid
. s4 I) V" f. O5 d9 L); 8 J8 ^/ X2 {3 t% b) C% ?
send_post('http://1.com/track.php', $post_data);
( W: M- d1 M- S9 wsend_post('http://2.com/track.php', $post_data);
2 l7 H2 j+ X2 Q$ |7 I4 u4 xsend_post('http://3.com/track.php', $post_data);
6 A0 v( |" u9 B" psend_post('http://4.com/track.php', $post_data); 5 l0 y& Z8 ~; C) q' M
?>$ c8 H! b) E1 B8 s+ Z
, ?8 m3 Q! l4 s9 h比如以上这段存为,trackredirect.php ,联盟那里call back url 填入 xxx.com/trackredirect.php?subid={subid},但是我测试了,不工作呢,好头痛,求专业人士帮忙看看哈2 L1 L6 B* p% {0 i
c' v2 p; R; q: i; y |