有些联盟只允许填入一个tracker的post back url,这对于同时使用好几个tracker的话实在是不方便,因此我想使用中转的办法,一个中转服务器收到联盟的postback url,然后再把track.php?subid=XXXX(以imobitrax为例)转发到其它几个tracker上,自己捣鼓了一下没成功,有人帮忙看看问题在哪吗?
5 `' ~. N" k- A3 X% I: F4 q- B7 v9 M) P; ?% K; P
<?php $subid=$_POST["subid"]; ?>
+ s8 ?+ \' |7 @( N, J' w<?php
5 K' Q3 X( a3 ?1 g4 V; k1 {function send_post($url, $post_data) {
% }- A) g \+ u8 |! G! p- Y/ X' h% @4 n: X X8 Y: E
$postdata = http_build_query($post_data); / w" F/ E4 j0 R( \6 R+ |0 k
$options = array( & |6 B2 z% n" L' t6 w" e4 o
'http' => array(
: m/ |; f/ v2 }% o4 {" a 'method' => 'POST',
- ` n& L' I0 V 'header' => 'Content-type:application/x-www-form-urlencoded',
( W, H2 ]; o- N9 ` 'content' => $postdata,
$ V, I7 c9 ~) P: @+ F" t 'timeout' => 15 * 60 // 超时时间(单位:s)
M2 z" x5 Y# V0 X, u ) 4 X/ h/ h$ ?. c- u* u, [ y
);
5 F9 F) n2 _" t+ Y. |+ D3 J $context = stream_context_create($options);
7 y- P L' V" T, \* Q $result = file_get_contents($url, false, $context); ! p) W1 z; O, F5 J* H, I. z
# w. m" m' j% R! P; s5 M return $result; / V- w9 S& g5 q: n* d& w
} 1 y1 D$ T7 r- H9 @* v- s
" ~: S/ ?# k4 _/ y2 i
//使用方法 / W3 _( Z; |' V8 n. N
$post_data = array(
D5 ?# H- I9 E a# ~ 'subid' => $subid
! @9 c- n, y: c);
u# O: F8 n. c5 msend_post('http://1.com/track.php', $post_data); % o8 K. N; O( n
send_post('http://2.com/track.php', $post_data); + k9 I8 O1 }1 D0 e
send_post('http://3.com/track.php', $post_data);
h# s( @2 K& G9 x+ ?1 k' {send_post('http://4.com/track.php', $post_data); " T) U% @; A9 v
?>$ Q, X, X/ E8 d% s; D/ M
* t& J) m, C; K* b4 E& j9 u$ G9 ^比如以上这段存为,trackredirect.php ,联盟那里call back url 填入 xxx.com/trackredirect.php?subid={subid},但是我测试了,不工作呢,好头痛,求专业人士帮忙看看哈
8 H f3 ?3 m3 m3 u1 s6 q! `9 n. L& y4 U9 v2 r r/ _% a
|