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
)
;
Ïà¹ØÎĵµ£º
ÏÈÏÂÔØ²¢°²×°eclipse£¬ÏÂÔØµØÖ·£ºhttp://download.Eclipse.org/downloads/index.php¡£Eclipse ÐèÒª jre µÄÖ§³Ö£¬ËùÒÔÈç¹û»úÆ÷ÉÏ»¹Ã»×°jreµÄ»°¾Í¸Ï¿ìÈ¥ÏÂÔØÒ»¸ö×°ÉÏ£¬http://java.sun.comÓÐjreµÄÏÂÔØ¡£
µÚ¶þ£¬ÏÂÔØ²¢°²×° PHP ÔÚ Eclipse µÄ²å¼þ
µØÖ·£ºhttp://sourceforge.net/project/showfiles.php?group_id=57621&pa ......
//½«ÍøÖ·µÄ²ÎÊýתΪ±äÁ¿,Èç:xxx.php?a=1&b=2,
//ÔËÐз½·¨ºó,echo $a."|".$b, ½á¹û:1|2
extract($_GET);
//unicodeתutf8£¬Èç:中»ò \u9865 ת ³É ÖÐÎÄ
function unescape($str) {
$str = rawurldecode($str);
preg_match_all("/(?:%u.{4})|&#x.{4};|&am ......
±¾À´²»Ïë̸Õâ¸ö³ÁÖØµÄ»°Ì⣬Æäʵ˵°×ÁË£¬Èç¹ûÄãÒ»¸öPHPµÄ³ÌÐòÔ±Á¬ÔõôÅäÖû·¾³¶¼¸ã²»¶¨Ä㻹¸ã¸öP¿ª·¢Ñ½¡£µÃ£¬ÔÛ²»ËµÄãÔÚlinuxÏÂÃæ¸ã¶¨ÕâЩ£¬ÄѵÀÄãÔÚwindowsÏÂÃæÄãÒ²¸ã²»¶¨£¿
ÏÖÔÚµÄPHP¶þ½øÖư²×°°æ±¾ÒѾ¿ÉÒÔÖ§³Öapache,iis5,iis6µÈһЩWEB·þÎñÆ÷ÁË£¬ÎªÊ²Ã´»¹ÊÇÓÐһЩÈ˲»»áÅäÖÃÄØ£¿ÕæÏ벻ͨѽ¡£¡£¡£¡£¡£¡£
ÓÚÊÇÔÚÕâÖÖ´ó ......
<?php
//$str = "abcdef¡ôÖлªÈËÃñ¹²ºÍ¹ú";
//$str = "1234567890";
$str = "ÖлªÈËÃñ¹²ºÍ¹úabcÖлªÈËÃñ¹²ºÍ¹úÖлªÈËÃñ¹²ºÍ¹ú";
$str = cut_str($str, 18);
echo $str;
function cut_str($str, $len){
if(strlen($str) <= $len) return $str;
$n = 0;
$tempstr = '';
for($i = 0; ......
½ñÌìÔÚдһ¸ö¶«Î÷ʱ£¬·¢ÏÖʱ¼äÒ»Ö±¶Ô²»ÉÏ£¬date("Y-m-d h:i:s") ×ÜÊÇÓë·þÎñÆ÷ʱ¼ä²î¼¸¸öСʱ£®
ÔÀ´´Óphp5.1.0¿ªÊ¼£¬php.iniÀï¼ÓÈëÁËdate.timezoneÕâ¸öÑ¡ÏĬÈÏÇé¿öÏÂÊǹرյÄ
Ò²¾ÍÊÇÏÔʾµÄʱ¼ä£¨ÎÞÂÛÓÃʲôphpÃüÁ¶¼ÊǸñÁÖÍþÖαê׼ʱ¼ä
ºÍÎÒÃǵÄʱ¼ä£¨±±¾©Ê±¼ä£©²îÁËÕýºÃ8¸öСʱ
½â¾ö·½Ê½:
Ò»¡ ......