Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

php curl ¼ò½é


Ô­ÎÄ
£¨Ó¢ÎÄ£©µØÖ·£º
http://www.phpit.net/article/using-curl-php
°æȨÉùÃ÷£ºÊðÃû-·ÇÉÌÒµÐÔʹ
ÓÃ-½ûÖ¹ÑÝÒï 2.0
ͻ񻣼
ÔÚÕâƪÎÄÕÂÖÐÖ÷Òª½²½â
php_curl¿âµÄ֪ʶ£¬²¢½ÌÄãÈçºÎ¸üºÃµÄʹÓÃphp_curl¡£
¼ò½é
Äã¿ÉÄÜÔÚÄãµÄ±àдPHP½Å
±¾´úÂëÖлáÓöµ½ÕâÑùµÄÎÊÌ⣺ÔõôÑù²ÅÄÜ´ÓÆäËûÕ¾µã»ñÈ¡ÄÚÈÝÄØ£¿ÕâÀïÓм¸¸ö½â¾ö·½Ê½£»×î¼òµ¥µÄ¾ÍÊÇÔÚphpÖÐʹÓÃfopen()º¯Êý£¬µ«ÊÇfopenº¯Êýû
ÓÐ×ã¹»µÄ²ÎÊýÀ´Ê¹Ó㬱ÈÈçµ±ÄãÏë¹¹½¨Ò»¸ö“ÍøÂçÅÀ³æ”£¬Ï붨ÒåÅÀ³æµÄ¿Í»§¶ËÃèÊö(IE,firefox),ͨ¹ý²»Í¬µÄÇëÇó·½Ê½À´»ñÈ¡ÄÚÈÝ£¬±ÈÈç
POST,GET£»µÈµÈÕâЩÐèÇóÊDz»¿ÉÄÜÓÃfopen()
º¯ÊýʵÏֵġ£
 
ΪÁ˽â¾öÎÒÃÇÉÏÃæÌá³öµÄÎÊ
Ì⣬ÎÒÃÇ¿ÉÒÔʹÓÃPHPµÄÀ©Õ¹¿â-Curl£¬Õâ¸öÀ©Õ¹¿âͨ³£ÊÇĬÈÏÔÚ°²×°°üÖеÄ,Äã¿ÉÒÔËüÀ´»ñÈ¡ÆäËûÕ¾µãµÄÄÚÈÝ£¬Ò²¿ÉÒÔÀ´¸É±ðµÄ¡£
 
±¸×¢£ºÕâÁ½¶Î´úÂëÐèÒªphp_curlÀ©Õ¹¿âµÄÖ§³Ö£¬²é¿´phpinfo()£¬Èç¹ûcurl
support enabledÔò±íʾ֧³Öcurl¿â¡£
1¡¢WindowsϵÄPHP¿ªÆôcurl¿âÖ§³Ö£º
´ò¿ªphp.ini£¬½«extension=php_curl.dllÇ°µÄ;ºÅÈ¥µô¡£
2¡¢LinuxϵÄPHP¿ªÆôcurl¿âÖ§³Ö£º
±àÒëPHPʱÔÚ./configureºó¼ÓÉÏ –with-curl
ÔÚÕâƪÎÄÕÂÖУ¬ÎÒÃÇÒ»ÆðÀ´¿´¿´ÈçºÎʹÓÃ
curl¿â£¬²¢¿´¿´ËüµÄÆäËûÓô¦£¬µ«ÊǽÓÏÂÀ´£¬ÎÒÃÇÒª´Ó×î»ù±¾µÄÓ÷¨¿ªÊ¼
»ù±¾Ó÷¨£º
µÚÒ»²½£¬ÎÒÃÇͨ¹ýº¯Êýcurl_init()
´´½¨Ò»¸öеÄcurl»á»°,´úÂëÈçÏ£º
<?php
// create a new curl resource
$ch = curl_init();
?>
ÎÒÃÇÒѾ­³É¹¦´´½¨ÁËÒ»¸öcurl»á»°£¬Èç¹ûÐèÒª»ñÈ¡Ò»¸öURLµÄÄÚÈÝ£¬ÄÇô½ÓϵÄÒ»²½£¬´«µÝÒ»¸öURL¸ø
curl_setopt()º¯Êý£¬´úÂ룺
<?php
// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, “http://www.google.com/”);
?>
×öÍêÉÏÒ»²½¹¤×÷£¬curlµÄ×¼±¸¹¤×÷×öÍêÁË£¬curl½«»á»ñÈ¡URLÕ¾µãµÄÄÚÈÝ£¬²¢´òÓ¡³öÀ´¡£´úÂ룺
<?php
// grab URL and pass it to the browser
curl_exec($ch);
?>
×îºó£¬¹Ø±Õµ±Ç°µÄcurl»á»°
<?php
//close curl resource, and free up system resources
curl_close($ch);
?>
ÏÂÃæÎÒÃÇÀ´¿´¿´Íê³ÉµÄʵÀý´úÂ룺
<?php
// create a new curl resource


Ïà¹ØÎĵµ£º

PHP¹¹Ô캯Êý


¡¡¡¡¹¹Ô캯ÊýÊÇPHPÖÐ×ÜÒªµÄ»ù±¾Óï·¨£¬Ê²Ã´Êǹ¹Ô캯ÊýÄØ?ÎÒÃÇÕâÀï¾ÍÒ»ÆðÀ´¿´¿´PHP¹¹Ô캯Êý¡£Èç¹ûÄãÔÚÒ»¸öÀàÖÐÉùÃ÷Ò»¸öº¯Êý,ÃüÃûΪ__construct,Õâ¸öº¯Êý½«±»µ±³ÉÊÇÒ»¸ö¹¹Ô캯Êý²¢ÔÚ½¨Á¢Ò»¸ö¶ÔÏóʵÀýʱ±»Ö´ÐÐ.Çå³þµØ˵,__ÊÇÁ½¸öÏ»®Ïß.¾ÍÏñÆäËüÈκκ¯ÊýÒ»Ñù,¹¹Ô캯Êý¿ÉÄÜÓвÎÊý»òÕßĬÈÏÖµ.Äã¿ÉÒÔ¶¨ÒåÒ»¸öÀàÀ´½¨Á¢Ò»¸ö¶ÔÏó²¢½ ......

ÔÚphpͼƬÖÐÊäÈëÖÐÎÄÎÄ×Ö½â¾öÂÒÂë

´úÂ룺
<?php
$im = imagecreatefromjpeg("ok.jpg");
$black = @imagecolorallocate($im, 0,0,0);
$jpgnumid = "ÕâÊÇǶÈ뵽ͼƬµÄÎÄ×Ö£¬½â¾öÁËÂÒÂëÎÊÌâ,
ÉÏÃæµÄok.jpgÊÇͬĿ¼ÏµÄÕÕƬ.ʹÓÃËüʱ£¬»¹ÐèÒªÓÐiconv
Ä£¿é£¡Ò²¾ÍÊÇ˵ÔÚphp.iniÀォ
[iconv]
iconv.input_encoding = ISO-8859-1
iconv.internal_encodin ......

PHP½âѹËõzipÎļþ

<?php
$zip_filename = "testpm.zip";
$zip_filename = key_exists('zip', $_GET) && $_GET['zip']?$_GET['zip']:$zip_filename;
$zip_filepath = str_replace('\\', '/', dirname(__FILE__)) . '/' . $zip_filename;
if(!is_file($zip_filepath))
{
    die('Îļþ"'.$zip_ ......

PHP SQL ×¢Èë¹¥»÷µÄ¼¼ÊõʵÏÖÒÔ¼°Ô¤·À°ì·¨

¡¡×î½üÔÚÕÛÌÚ PHP + MYSQL
µÄ±à³Ì¡£Á˽âÁËһЩ PHP SQL ×¢Èë¹¥»÷
µÄ֪ʶ£¬ÓÚÊÇдÁËÕâƪÎÄÕ¡¡http://www.xiaohui.com/weekly/20070314.htm£¬×ܽáһϾ­Ñé¡£ÔÚÎÒ¿´À´£¬Òý·¢ SQL ×¢Èë¹¥»÷
µÄÖ÷ÒªÔ­Òò£¬ÊÇÒòΪÒÔÏÂÁ½µãÔ­Òò£º
¡¡¡¡1. php ÅäÖÃÎļþ php.ini ÖÐµÄ magic_quotes_gpc
Ñ¡ÏîûÓдò¿ª£¬±»ÖÃΪ off
¡¡¡¡2. ¿ª·¢ ......

php is_dirÎÞ·¨ÕýÈ··µ»ØµÄ½â¾ö°ì·¨

phpÖÐis_dirÖÐÄÜ·ñÕýÈ··µ»ØȷʵºÍĿ¼ȨÏÞÉèÖÃÓйØϵ¡£¡£¡£
ŪÁ˺þᣡ£Ò»Ö±ÒÔΪ²»ÊÇȨÏÞÎÊÌâ¡£
»·¾³ÊÇiis6.0+php5.2
ÍøվĿ¼ÊÇÔÚd:\vhost\web1
ÒªÓÃis_dirº¯Êý±ØÐëÉèÖÃȨÏÞd:\£¬d:\vhostΪ¿É¶Á¿ÉÁÐĿ¼
Ò²¾ÍÊÇweb1Ç°Ã漸¼¶µÄĿ¼¶¼ÒªÓпɶÁ¿ÉÁÐĿ¼µÄȨÏÞ¡£ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ