php ͨ¹ýfsockopen Ä£ÄâPOSTÌá½»
$URL
=‘
http
:
//xxx.xxx.xxx.xx/xx/xxx/top.php';
$post_data
[
'
clientname
'
]
=
"
test08
"
;
$post_data
[
'
clientpasswd
'
]
=
"
test08
"
;
$post_data
[
'
submit
'
]
=
"
¥í¥°¥¤¥ó
"
;
$referrer
=
""
;
// parsing the given URL
$URL_Info
=
parse_url
(
$URL
)
;
// Building referrer
if
(
$referrer
==
""
)
// if not given use this script as referrer
$referrer
=
$_SERVER
[
"
SCRIPT_URI
"
]
;
// making string from $data
foreach
(
$post_data
as
$key
=>
$value
)
$values
[]
=
"
$key
=
"
.
urlencode
(
$value
)
;
$data_string
=
implode
(
"
&
"
,
$values
)
;
// Find out which port is needed - if not given use standard (=80)
if
(
!
isset
(
$URL_Info
[
"
port
"
]))
$URL_Info
[
"
port
"
]
=
80
;
// building POST-request:
$request
.=
"
POST
"
.
$URL_Info
[
"
path
"
]
.
"
HTTP/1.1
\n
"
;
$request
.=
"
Host:
"
.
$URL_Info
[
"
host
"
]
.
"
\n
"
;
$request
.=
"
Referer:
$referrer
\n
"
;
$request
.=
"
Content-type: application/x-www-form-urlencoded
\n
"
;
$request
.=
"
Content-length:
"
.
strlen
(
$data_string
)
.
"
\n
"
;
$request
.=
"
Connection: close
\n
"
;
$request
.=
"
\n
"
;
$request
.=
$data_string
.
"
\n
"
;
$fp
=
fsockopen
(
$URL_Info
[
"
host
"
]
,
$URL_Info
[
"
port
"
])
;
fputs
(
$fp
,
$request
)
;
while
(
!
feof
(
$fp
))
{
$result
.=
fgets
(
$fp
,
128
)
;
}
fclose
(
$fp
)
;
Ïà¹ØÎĵµ£º
Èç¹û²»¾ß±¸ÐÞ¸Äphp.iniµÄȨÏÞ£¬¿ÉÒÔÈçÏ£º
ini_set("display_errors", "On");
error_reporting(E_ALL | E_STRICT);
µ±È»£¬Èç¹ûÄܹ»ÐÞ¸Äphp.iniµÄ»°£¬Èçϼ´¿É£º
display_errors = On
error_reporting = E_ALL & ~E_NOTICE ......
ͼ±í¿â
ÏÂÃæµÄÀà¿â¿ÉÒÔÈÃÄãºÜ¼òµÄ´´½¨¸´ÔÓµÄͼ±íºÍͼƬ¡£µ±È»£¬ËüÃÇÐèÒªGD¿âµÄÖ§³Ö¡£
pChart - Ò»¸ö¿ÉÒÔ´´½¨Í³¼ÆͼµÄ¿â¡£
Libchart - ÕâÒ²ÊÇÒ»¸ö¼òµ¥µÄͳ¼Æͼ¿â¡£
JpGraph - Ò»¸öÃæÏò¶ÔÏóµÄͼƬ´´½¨Àà¡£
Open Flash Chart - ÕâÊÇÒ»¸ö»ùÓÚFlashµÄͳ¼Æͼ¡£
RSS ½âÎö
½âÊÍRSS²¢ÊÇÒ»¼þºÜµ¥µ÷µÄÊÂÇé£ ......
½ñÌìÔÚдһ¸ö¶«Î÷ʱ£¬·¢ÏÖʱ¼äÒ»Ö±¶Ô²»ÉÏ£¬date("Y-m-d h:i:s") ×ÜÊÇÓë·þÎñÆ÷ʱ¼ä²î¼¸¸öСʱ£®
ÔÀ´´Óphp5.1.0¿ªÊ¼£¬php.iniÀï¼ÓÈëÁËdate.timezoneÕâ¸öÑ¡ÏĬÈÏÇé¿öÏÂÊǹرյÄ
Ò²¾ÍÊÇÏÔʾµÄʱ¼ä£¨ÎÞÂÛÓÃʲôphpÃüÁ¶¼ÊǸñÁÖÍþÖαê׼ʱ¼ä
ºÍÎÒÃǵÄʱ¼ä£¨±±¾©Ê±¼ä£©²îÁËÕýºÃ8¸öСʱ
½â¾ö·½Ê½:
Ò»¡ ......
1. дһ¸öº¯Êý£¬¾¡¿ÉÄܸßЧµÄ£¬´ÓÒ»¸ö±ê×¼ url
ÀïÈ¡³öÎļþµÄÀ©Õ¹Ãû
ÀýÈç: http://www.sina.com.cn/abc/de/fg.php
?id=1
ÐèҪȡ³ö php »ò .php
2. ÔÚ HTML ÓïÑÔÖУ¬Ò³ÃæÍ·²¿µÄ meta ±ê¼Ç¿ÉÒÔÓÃÀ´Êä³öÎļþµÄ±àÂë
¸ñʽ£¬ÒÔÏÂÊÇÒ»¸ö±ê×¼µÄ meta Óï¾ä
<META http-equiv='Content-Type
' ......
»ù´¡Ìâ
¡¡¡¡1.±íµ¥ÖÐ getÓëpostÌá½»·½·¨µÄÇø±ð?
¡¡¡¡´ð£ºgetÓû§¶Ë½«Êý¾Ý¼Óµ½URLºó£¬¸ñʽΪ”?×Ö¶Î1=ÊäÈëÊý¾Ý1&×Ö¶Î2=ÊäÈëÊý¾Ý2&..."¡£
¡¡¡¡ÓÉÓÚgetÌá½»²ÎÊýºó»áÔÚµØÖ·À¸ÖÐÏÔʾ³öÀ´£¬ËùÒÔ»á²úÉúÑÏÖصݲȫÎÊÌâ¡£
¡¡¡¡get´«ÊäµÄÊý¾ÝÁ¿Ð¡£¬get´«ÊäµÄÊý¾ÝÁ¿Ð¡£¬ÕâÖ÷ÒªÊÇÒòΪÊÜurl³¤¶ÈÏÞÖÆ;¶øpost¿ÉÒÔ´«Ê ......