php postÊý¾Ý,cookie³ÌÐò
<?php
$url="ÕâÀïдÇëÇóµØÖ·";//http://pmtest.webgame.com.cn/d.php
$data="ÕâÀïдpostÊý¾Ý";//Èç:a=123&b=456 ±íʾ´«Á½¸ö²ÎÊýaºÍb
$rfr="·¢³öÊý¾ÝµÄÒ³ÃæµÄµØÖ·";
$cookie="ÕâÀïдcookie";//Èç:PHPSESSIDs=123456; b=11212
/*
Àý×Ó:
$rfr="http://*.cn/d.php";
$url='http://*.cn/d.php';
$data="a=123&b=456";
$cookie="PHPSESSIDs=123456; b=11212";
*/
echo "start";
$url = parse_url($url);
#if (!$url) return "couldn't parse url";
if (!isset($url['port'])) { $url['port'] = ""; }
if (!isset($url['query'])) { $url['query'] = ""; }
$encoded = $data;
$fp = fsockopen($url['host'], $url['port'] ? $url['port'] : 80);
#if (!$fp) return "Failed to open socket to $url[host]";
fputs($fp, sprintf("POST %s%s%s HTTP/1.0\n", $url['path'], $url['query'] ? "?" : "", $url['query']));
if(!empty($rfr))
{
fputs($fp, "Referer: $rfr\n");
}
if(!empty($cookie))
{
fputs($fp, "Cookie: $cookie\n");
}
fputs($fp, "Host: $url[host]\n");
fputs($fp, "Content-type: application/x-www-form-urlencoded\n");
fputs($fp, "Content-length: " . strlen($encoded) . "\n");
fputs($fp, "Connection: close\n\n");
fputs($fp, "$encoded\n");
$line = fgets($fp,1024);
$results = ""; $inheader = 1;
while(!feof($fp)) {
$line = fgets($fp,1024);
if ($inheader && ($line == "\n" || $line == "\r\n")) {
$inheader = 0;
}
elseif (!$inheader) {
$results .= $line;
}
}
fclose($fp);
echo $results;
?>
Ïà¹ØÎĵµ£º
£¨×ª£©ÎÊÌ⣺
ÓÐûÓа취ÔÚphpÖÐʵÏÖ¶àÏß³ÌÄØ£¿
¼ÙÉèÄãÕýÔÚдһ¸ö»ùÓÚ¶ą̀·þÎñÆ÷µÄphpÓ¦Óã¬ÀíÏëµÄÇé¿öʱͬʱÏò¶ą̀·þÎñÆ÷·¢ËÍÇëÇ󣬶ø²»ÊÇһ̨½Óһ̨¡£
¿ÉÒÔʵÏÖÂð£¿
»Ø´ð£º
µ±ÓÐÈËÏëҪʵÏÖ²¢·¢¹¦ÄÜʱ£¬ËûÃÇͨ³£»áÏëµ½ÓÃfork»òÕßspawn threads£¬µ«Êǵ±ËûÃÇ·¢ÏÖphp²»Ö§³Ö¶àÏ̵߳Äʱºò£¬´ó¸Å»áת»»Ë¼Â·È¥ÓÃһЩ²»¹»ºÃµÄ ......
ÓÃphp»ñÈ¡±¾ÖÜ,ÉÏÖÜ,±¾ÔÂ,ÉÏÔÂ,±¾¼¾¶ÈÈÕÆڵĴúÂë,Ö÷ÒªÓõ½date,strtotimeºÍmktimeº¯Êý.
echo date("Ymd",strtotime("now")), "<br />";
echo date("Ymd",strtotime("-1 week Monday")), "<br />";
echo date("Ymd",strtotime("-1 week Sunday")), "<br />";
echo date("Ymd",strtotime("+0 week ......
php -h¿ÉÒÔ»ñÈ¡°ïÖúÐÅÏ¢¡£PHP°æ±¾ºÅÐÅÏ¢£º/your_current_path/php -v£¬PHPÔËÐнű¾£º/your_current_path/php your_file_path£¬PHPÔËÐÐÓï¾ä/your_current_path/php -r your_code_snippet¡£
´úÂëÖ´ÐнáÊøºó£¬PHP»á¸ù¾Ý¾ßÌåÖ´ÐÐÇé¿ö×Ô¶¯µÄÊÍ·Å£¬Èç¹ûÖ´Ðйý³ÌÖÐÄÚ´æÏûºÄ½Ï´ó£¬¿ÉÒÔÀûÓÃNULL»òunsetÀ´ÊÍ·ÅÄÚ´æ¡£Çø±ðÔÚÓÚ£¬Ç°Õß ......
//ת»»ÎªUNIXʱ¼ä´Á
function strtotimestamp(datestr)
{
var new_str = datestr.replace(/:/g,"-");
new_str = new_str.replace(/ /g,"-");
var arr = new_str.split("-");
var datum = new Date(Date. ......
¡¡¡¡ÎÒ¿ª·¢µÄСվ£ºhttp://www.asprain.com£¬»¶Ó¹ÛĦ¡¢ÌåÑ飡
¡¡¡¡°¡£¬½ñÌì¿´µ½ºÜ¶àÈË˵ÎÒÂîPHP³ÌÐòÔ±ÊÇÔÚ³´×÷£¬Ä¿µÄÊÇÍƹãÎÒµÄÂÛ̳³ÌÐò¡£»°Ëµ£¬ËäÈ»ÎÒ֮ǰһֱºÜÏëÏë°ì·¨Ìá¸ß×Ô¼ºÐ´µÄÄǸö³ÌÐòµÄÖªÃû¶È¡£ÎÒ°ÑÎÒµÄСվ½éÉܸøÎÒµÄËùÓеĺÃÓÑ£¬ÇëËûÃÇ¿Ú¿ÚÏà´«¡£µ«ÊÇÎÒȷʵдÕâƪÎÄÕÂÊÇûÓг´×÷Ä¿µÄµÄ¡£ÔÒòºÜ¼òµ¥£ºÎÒÐ ......