luguokankan 發表於 2013-9-14 17:32 
q- t. S% {7 y; y0 S做出來記得給我一份啊
! G7 ]3 _1 d3 w* s您這樣的大牛,博士生導師級別的, 拿小弟開玩笑吧 呵呵 
3 C! R) m! \( n/ W2 g6 b) {" O" q
這個是我實現的代碼:
0 m1 d) e9 D" x8 L8 w$ w+ a3 N
1 E% H G) x0 T3 H; `<?php
# E: h7 O! s7 g3 |6 ? ^: z$url = 'http://arcadegameworld.com/play/stone-age-mahjong-connect/';
' ^- n! C3 I0 d5 O7 n1 ]$ T
9 _2 L8 P1 F3 E6 }) p$header = get_header($url);
4 A% C0 j2 I5 {9 t2 Jecho $header;: n; ~" H3 w4 V/ g! ~ |1 R2 P% Q
1 S ]+ {. y. z3 i1 t& I9 Ifunction get_header($url){
4 K# x9 K& s; p c, z* g/ r: A! k $ch = curl_init();9 `) p/ A/ y. _/ h* W: h
curl_setopt($ch, CURLOPT_URL, $url);7 @+ V3 U& O" E8 M
curl_setopt($ch, CURLOPT_HEADER, true);
( N! c' c; {& D curl_setopt($ch, CURLOPT_NOBODY,true);
% e Y) F9 D9 ]9 `& Y/ p9 x curl_setopt($ch, CURLOPT_RETURNTRANSFER,true);, v3 S4 N N# _9 Y! r. Q
//curl_setopt($ch, CURLOPT_FOLLOWLOCATION,true);
) `% M) l2 `7 s, N curl_setopt($ch, CURLOPT_AUTOREFERER,true);
: _7 s; b) k! z/ H" v curl_setopt($ch, CURLOPT_TIMEOUT,30);0 i0 D) M$ v+ i0 a; x
curl_setopt($ch, CURLOPT_HTTPHEADER, array(4 j& K/ A& z3 L9 s0 N/ V
'Accept: */*',6 E* T- L' n* V7 Y4 |6 Z
'User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)',2 A: T q- c6 k W+ {2 C
'Connection: Keep-Alive'));
# g/ a% a) o+ S9 n! Y) D; Y $header = curl_exec($C);) q. Z+ {$ k& H5 E$ K1 A" D$ T9 g
return $header;* S9 R7 X- F3 s7 M3 ^
}
! c) {4 f0 l% t2 i1 |. A?> # t D! Q* Z8 n) D% ~
; c+ ~8 k, `* N$ S( A: J- v
! G9 W! G9 | i2 R4 b, u8 b X$ a! b( F$ H: e$ N( l# N! M) S w
運行後的結果:
/ g" j+ n1 C" N. [& B7 r- ^# J8 E6 E7 a H q' I" A& ?8 @
, m9 Z1 T9 @) w/ U$ ^) a3 w8 I& {" [+ G; y) M
# u+ f0 U5 i" h, x" I9 b& z2 s- K: h) E' J' D- ^
! [8 M) ]2 S+ e% i4 L
* j! ~% t9 |" Q- V- f3 P% e9 G& y5 @
$ ~; {/ s3 w/ c* O
5 V) q, f% O$ }$ O# o
' [! k6 |5 O6 s% z
|