luguokankan 發表於 2013-9-14 17:32 
& e& D6 t& \ [( @* B- T做出來記得給我一份啊 4 s# B' V+ Y* F- S
您這樣的大牛,博士生導師級別的, 拿小弟開玩笑吧 呵呵 " |4 X6 s A6 J$ H
' g" h: u& H, N# O
這個是我實現的代碼:' k$ n0 w L. n8 Q' E5 e
: X9 c& Y7 C3 E9 D<?php9 L# T3 k, [6 S/ E5 S
$url = 'http://arcadegameworld.com/play/stone-age-mahjong-connect/';
, N; x: {: b2 D/ V, l l9 ?6 w# ]% {5 `( z5 [& K* [: }
$header = get_header($url);7 O$ D6 E' i+ X+ ^7 r
echo $header;- P4 r1 }( `3 {- v
/ r& E5 P% n- P( @function get_header($url){8 h- S! T4 s6 Z5 D8 ^, j6 H8 n; M
$ch = curl_init();
4 |' R1 f+ W- U# c0 H& i0 L curl_setopt($ch, CURLOPT_URL, $url);3 k; W9 H: k8 }. S1 `* ^
curl_setopt($ch, CURLOPT_HEADER, true);( f3 W) t1 t- z [: X8 J: ~+ ]/ h
curl_setopt($ch, CURLOPT_NOBODY,true);
5 Z0 E6 Z( W7 k. U: E! r curl_setopt($ch, CURLOPT_RETURNTRANSFER,true);
0 I5 _+ z% \1 ~ E' } //curl_setopt($ch, CURLOPT_FOLLOWLOCATION,true);$ @+ Q" j- g+ o& Z
curl_setopt($ch, CURLOPT_AUTOREFERER,true);+ S( @8 ^* q) C* i! O
curl_setopt($ch, CURLOPT_TIMEOUT,30);
6 P6 c$ t& Y3 R$ a curl_setopt($ch, CURLOPT_HTTPHEADER, array(
$ B, y! a9 h8 | 'Accept: */*',
1 p* I, J( o- m) f 'User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)',
$ ^; f: C) @9 p' _) j) x 'Connection: Keep-Alive'));4 e, l( H2 o' `. R
$header = curl_exec($C);
( R( r) q' T2 X$ \) e( T return $header;
8 g& F3 v& t' y# n& P, o5 a( D}& P! i. a# @& \8 K V
?> ) P- f" n$ B$ _/ L
3 G; t) N) Q. T
" k& v" K) d8 \1 K, _5 G
: p- k9 D0 e$ W5 x. v2 \, d運行後的結果:
+ D) A# Z" B, y; W$ Q; I
Y* V5 u' y I. W8 P2 \ _- A J1 n
. N, D9 f" |- v: N5 ]3 S) M/ h- P; v) I7 {
$ M3 f8 i: J2 M0 h1 \
4 ]+ u+ a; ^6 x9 I- z0 j# B7 T: ~5 o( F' ]
) B' c8 h: o$ f% J1 ^( y: q
% X/ X0 L0 Z/ `. B8 ~3 W
% w3 G$ b1 }/ f# L8 {, R4 W, |* P0 {8 O) \ |