luguokankan 發表於 2013-9-14 17:32 
( p& q u+ Q; P4 o% e$ k做出來記得給我一份啊 ; Z. M# E- b+ P$ i( e
您這樣的大牛,博士生導師級別的, 拿小弟開玩笑吧 呵呵 
+ U9 T1 j" ?2 N, m" ]+ L. r; W4 x
- B( o: W. o' e這個是我實現的代碼:
% u2 w$ B, e+ t+ A0 j. g! B! S0 }7 l1 f' a9 f& a' M( u
<?php
5 i9 {% `' T8 u7 k. g4 @3 e$url = 'http://arcadegameworld.com/play/stone-age-mahjong-connect/';" l6 ]7 K0 i2 s, w
, |7 j6 q: [ \' E$header = get_header($url);
6 x; [9 w% m- E+ W4 necho $header; v6 g+ F2 i0 H5 w$ z
: m8 s/ _. e1 B1 {& A/ j
function get_header($url){
2 t5 Q4 a* @6 E( k2 K, C $ch = curl_init();
: \+ R( [; _' t- C% E i7 w: Z curl_setopt($ch, CURLOPT_URL, $url);
/ k. h$ ~# E- ~& {: d# P0 [+ v curl_setopt($ch, CURLOPT_HEADER, true);
0 \* U: t" D: O+ G4 x5 q curl_setopt($ch, CURLOPT_NOBODY,true);
O9 J2 n* T' U* H. N curl_setopt($ch, CURLOPT_RETURNTRANSFER,true);
4 r( n# m1 E b; s) ? //curl_setopt($ch, CURLOPT_FOLLOWLOCATION,true);% u, O, G5 N$ m% t" U V8 C: x2 }
curl_setopt($ch, CURLOPT_AUTOREFERER,true);
4 [( B. P; W9 }6 U curl_setopt($ch, CURLOPT_TIMEOUT,30);
E/ ~! u7 K! @) G( e curl_setopt($ch, CURLOPT_HTTPHEADER, array(
( ?/ o0 D0 @4 g' v2 M- n p7 |; { 'Accept: */*',9 ?! O: I, A3 D/ F2 a, @+ p- g; ^
'User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)',; s4 O* L- E ?9 w; f' X; |7 P4 ?
'Connection: Keep-Alive'));8 l$ E8 R" ] S: r
$header = curl_exec($C);
) q# E% ~6 V5 e% H. Z return $header;, Y( G3 ^. k" O' [ p/ z5 ~; W
}+ M: `8 k, A/ k% I$ a
?> 5 L0 M! [; V5 s0 b. r9 ?2 x4 f, a
: ^! G3 Y4 Y8 t/ M
8 I t! K- G4 d; P3 R) X6 G2 ?- p& a4 G$ G! E
運行後的結果:8 F8 u8 V- `) x0 }1 U1 f& d' X
" C' M4 `" [% p. b6 j' m
, g1 r0 M4 f- C4 N& e1 \
$ i4 h( J8 V" Z5 N7 h$ C1 H1 Z& p; d0 F$ E7 C' P
$ g/ Y& F; B, n$ [& E, V$ Q* t& B8 r8 v8 J! R0 t
- \) g# s$ R: K, r+ R7 M
. C' a; K3 W. N8 t: F0 s+ n5 H) N% t; k. d" H. w- i
+ P B v9 n& `5 a7 A5 p O |