有些联盟只允许填入一个tracker的post back url,这对于同时使用好几个tracker的话实在是不方便,因此我想使用中转的办法,一个中转服务器收到联盟的postback url,然后再把track.php?subid=XXXX(以imobitrax为例)转发到其它几个tracker上,自己捣鼓了一下没成功,有人帮忙看看问题在哪吗?
: q$ B, M8 Z* @ { f9 v
- {9 D0 t2 l) P) i<?php $subid=$_POST["subid"]; ?>
" s7 `$ }) W; A r<?php t5 ^# T3 w+ b6 K' y4 T. l. o
function send_post($url, $post_data) {
4 S2 G5 U( e8 |# w: P8 K' h' ]6 E: T4 a" y% B
$postdata = http_build_query($post_data); " E' k: ~8 }. C- s6 \: K
$options = array(
% o+ z$ g5 e: [$ _! o4 e* d1 H 'http' => array( 6 u/ W0 f7 d6 P) B0 R: G
'method' => 'POST', : `% R; c3 d8 ?0 S1 ~& N- I6 V2 f# L
'header' => 'Content-type:application/x-www-form-urlencoded',
8 q% o0 B1 O& ?9 y* X: a& n 'content' => $postdata,
* n: q$ L9 C: [ 'timeout' => 15 * 60 // 超时时间(单位:s) 8 h. }- Q8 ^( K- f1 W
) : I, @8 T+ d* }& p, g: ?4 b* J
);
- m/ O7 r) ~- r; H/ @" e' ` $context = stream_context_create($options); 0 m+ ?8 Q2 F6 d2 A0 K( j
$result = file_get_contents($url, false, $context);
, ^5 Q4 Z8 N- Z9 C5 K% Q/ r) h. q1 c
return $result; $ S" u3 I* j* Q" c
} 8 ? O3 @9 F( |- q4 J
$ b( ^/ q/ j8 M2 j; R/ [
//使用方法
V5 t, I( a x( K8 s9 `& |! S( K$post_data = array( 6 p( G% U, f7 s4 l
'subid' => $subid
! h8 I. L9 w# M; M# u);
5 C& |' x' N8 ]6 p: O! r) g, A% Asend_post('http://1.com/track.php', $post_data); 7 {/ m* u& n$ j3 m1 v* @7 x: X
send_post('http://2.com/track.php', $post_data); & B& B/ K' g6 g9 ~* H: f. A
send_post('http://3.com/track.php', $post_data);
# r+ h5 n9 ?# t" ~6 d7 Osend_post('http://4.com/track.php', $post_data);
+ K" _9 \* W& q* w6 T" Z5 r?>7 j# m5 r' ]* v* r& S3 `
?9 _& C0 b. ~4 p比如以上这段存为,trackredirect.php ,联盟那里call back url 填入 xxx.com/trackredirect.php?subid={subid},但是我测试了,不工作呢,好头痛,求专业人士帮忙看看哈
+ G0 ]4 h/ s# W5 m* a7 f+ p) M+ ]
|