luguokankan 發表於 2013-9-14 17:32 
- q- s8 C! f1 f7 p4 N4 X( r) y7 h E做出來記得給我一份啊 1 k+ r/ d }7 _; A2 x
您這樣的大牛,博士生導師級別的, 拿小弟開玩笑吧 呵呵 + D8 l0 c/ B! ~
# D+ t7 q8 b0 g, P1 Q這個是我實現的代碼:8 B- N g; t7 a( G( a
( ?1 {1 j2 F! @1 \0 x<?php: r$ E" f$ J4 G) t7 I2 B/ }
$url = 'http://arcadegameworld.com/play/stone-age-mahjong-connect/';
. t! W5 u( ^. U' }3 R# A
1 g. M) M. v8 p; V0 [$header = get_header($url);
) N/ U: u' ~7 r7 d- K0 lecho $header;. |) f2 p) B9 ]% c; G& [+ z
( b3 G5 d& b. Rfunction get_header($url){
" \" M+ r6 }$ } $ch = curl_init();
4 o8 H1 l4 B- ?# {! x& E7 l) P2 O curl_setopt($ch, CURLOPT_URL, $url);
7 r4 ?+ u: A: C9 s( M' p/ M1 z6 g curl_setopt($ch, CURLOPT_HEADER, true);
0 G! o4 K& p7 h curl_setopt($ch, CURLOPT_NOBODY,true);
# ]& K* m' [ v' G) a3 y curl_setopt($ch, CURLOPT_RETURNTRANSFER,true);
; q4 {. C( i" Q //curl_setopt($ch, CURLOPT_FOLLOWLOCATION,true);- p% C; t% f2 f8 D" [
curl_setopt($ch, CURLOPT_AUTOREFERER,true);
1 T1 ]7 Z" Q$ E9 n4 U4 x' b curl_setopt($ch, CURLOPT_TIMEOUT,30);1 {' W& H; e: b6 ^* T) q% G7 `
curl_setopt($ch, CURLOPT_HTTPHEADER, array(! ^8 }- A) l# w3 G) ?+ Y
'Accept: */*',! W" Y3 N' a7 Y
'User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)',5 y |5 n3 ~1 ?" @8 Q
'Connection: Keep-Alive'));( b2 G* d. _+ Z0 o1 U v) `
$header = curl_exec($C);- H( B7 `3 }# y* M' _6 a9 S
return $header; p- x+ D6 [5 F# A
}& ]; b' ~* N0 |2 ?& h$ f# h4 r
?>
" W* Y- i4 a& F, F' [# ~( J3 G
! J+ `. _& `3 b
$ R: f3 o8 l; D3 I) p; {# y
' s2 z6 l: c" n運行後的結果:
+ g7 r& P5 U2 _' y/ p V3 W- D5 l' S) _
1 S4 H: W+ m9 j7 G$ @( Z3 [/ \2 m
8 t6 S) } t1 W; a
7 X4 L! c5 O' u' x5 u* D6 h9 b3 N7 i% o4 A: v. @
' x: ?& u+ v, C: K9 @) L& d! k8 P. I% K
% k( O, e, e1 J6 q& B
3 y8 g" w+ \6 c
|