有些联盟只允许填入一个tracker的post back url,这对于同时使用好几个tracker的话实在是不方便,因此我想使用中转的办法,一个中转服务器收到联盟的postback url,然后再把track.php?subid=XXXX(以imobitrax为例)转发到其它几个tracker上,自己捣鼓了一下没成功,有人帮忙看看问题在哪吗?
- x9 m$ h/ g$ H. N; W. R
" n2 v# k4 _5 I<?php $subid=$_POST["subid"]; ?>
$ }0 ~' b9 l# _: K<?php" y- j j5 l+ U8 ^
function send_post($url, $post_data) { ! d4 h2 w! G t. E
7 D5 J0 [! R( C1 x8 V5 d $postdata = http_build_query($post_data); 0 o/ a3 t, `) {$ j
$options = array(
3 Q8 y+ K0 i- ]5 I7 G6 J" } 'http' => array(
+ M( E$ i8 w+ G/ G0 ~1 P. D8 L 'method' => 'POST',
8 m0 F3 V) z* l 'header' => 'Content-type:application/x-www-form-urlencoded', ) T1 A* @% W; x1 y5 y/ [
'content' => $postdata,
( t. ^: |( C2 Z3 j1 s O; Q 'timeout' => 15 * 60 // 超时时间(单位:s) ) d* T* H M1 y. X, j
) + s# R+ b& E: b0 B2 S
);
4 N4 J7 i9 c2 R5 u6 d $context = stream_context_create($options); $ F6 T* P& b1 B9 h( K6 S r
$result = file_get_contents($url, false, $context);
- y; R8 K3 Y' s- i
$ p. ]' F& l( |1 O4 e return $result;
# G) _/ j3 c' Q$ D5 u; t} " _$ w& o! `- i4 A) Z9 y
8 M/ X2 P. G1 n# v- n& o% T, }# \4 o: G
//使用方法
Q# P5 r$ [* T! U( J9 N$post_data = array( 4 H# ?9 p4 U4 u
'subid' => $subid
: T) e$ B C0 z5 L);
9 e/ l, _) f7 w. U! ^) ssend_post('http://1.com/track.php', $post_data); ' e4 ?$ T: Z7 Z# Z
send_post('http://2.com/track.php', $post_data);
+ c* G9 s" _$ r! msend_post('http://3.com/track.php', $post_data);
" Q9 h- \. d' Isend_post('http://4.com/track.php', $post_data); 8 ^; f0 B9 N& l( w
?>
, F1 I/ @( @' n% V0 F+ F- U. f7 y" p) G+ d- Q& b
比如以上这段存为,trackredirect.php ,联盟那里call back url 填入 xxx.com/trackredirect.php?subid={subid},但是我测试了,不工作呢,好头痛,求专业人士帮忙看看哈
% s+ `, A% K+ G4 p! x l2 {" }0 ?9 P5 ?$ C* D6 b7 ^
|