有些联盟只允许填入一个tracker的post back url,这对于同时使用好几个tracker的话实在是不方便,因此我想使用中转的办法,一个中转服务器收到联盟的postback url,然后再把track.php?subid=XXXX(以imobitrax为例)转发到其它几个tracker上,自己捣鼓了一下没成功,有人帮忙看看问题在哪吗?
# o) F+ F" d+ t! P
5 n- q8 a; C4 o! K1 |) x# {* s<?php $subid=$_POST["subid"]; ?>
\# a% z3 r$ G; X0 r! ^+ Z) ?<?php
" r* @; ?, ?6 L$ jfunction send_post($url, $post_data) { R. N: j" B1 u- W+ G! }! x2 }
" U: F# ]0 }/ {" C( k, K $postdata = http_build_query($post_data);
0 u/ ?+ I7 r1 _; g1 S $options = array(
2 _2 C# q' u' ^) l 'http' => array( 1 V6 E- B/ m0 R* m
'method' => 'POST', 8 n2 A& f4 x x
'header' => 'Content-type:application/x-www-form-urlencoded', I% w: T6 v: ]2 ^0 A1 ^
'content' => $postdata,
: e0 B8 `7 V y: x4 F5 J$ [* r 'timeout' => 15 * 60 // 超时时间(单位:s) ' G5 ?. c5 K+ A# N( v$ U9 \
) 3 w2 s0 `2 Y4 ^0 ^ h$ f, R! H
);
0 ], H" J* E% \/ f, M $context = stream_context_create($options);
f1 c! Q0 T) x- d $result = file_get_contents($url, false, $context); # {: Z& A1 X P- N
9 w& @, {% e' g return $result;
+ b9 F3 K: a0 Z* e6 I4 M! C+ x}
9 t% P, Z) _, G4 K5 _' W6 u. q2 d
% i9 [" i1 S) `: c//使用方法
3 n# c. @7 }; \& v3 k8 \% I8 R/ q) U$post_data = array( ! i2 I( Q. j; J. K' ]7 Y
'subid' => $subid * q! N# {+ U8 ]& V) z
);
) j. V/ t# a) C7 f/ lsend_post('http://1.com/track.php', $post_data);
8 J0 t! C2 W) O q2 A! |( x3 K- Ysend_post('http://2.com/track.php', $post_data);
5 G2 \- F+ c0 P* g! h4 ^send_post('http://3.com/track.php', $post_data); % ~8 O& d9 h7 R0 p7 z }- f! `: i! i
send_post('http://4.com/track.php', $post_data); 3 F9 L+ d. b6 A5 t- P
?>, e4 y/ j$ O. U) W# a
5 U! V, [6 i- R# L
比如以上这段存为,trackredirect.php ,联盟那里call back url 填入 xxx.com/trackredirect.php?subid={subid},但是我测试了,不工作呢,好头痛,求专业人士帮忙看看哈
) E' y% N' C4 R" @! X5 v# z; y% O* D; t. S
|