Class
- Tip&Tech
| [ÇÔ¼ö] ¼ÒÄÏÀ¸·Î ÆÄÀÏÀü¼ÛÇϱâ | |||||
| ±Û¾´ÀÌ | ³¯ Â¥ | 11-07-26 16:35 | Á¶ ȸ | 4473 | |
|---|---|---|---|---|---|
| °£ÆíURL |
http://www.phpschool.com/link/tipntech/74051
|
||||
| ´Ù¿î·Îµå1 | HttpClient.zip (3.7K), Down : 184, 2011-07-26 16:35:57 | ||||
|
/*
* Diese Version des HttpClients wurde von Sven Wappler erstellt. Sie basiert auf * HttpClient 0.9 von Simon Willison (http://simon.incutio.com) * http://www.wappler.eu/wp-content/uploads/files/HttpClient.class.phps (Original Sorce Link) * Last Modify by kalsome Baesang 07/26/2011 */ ¼ÒÄÏÀ¸·Î ÆÄÀÏÀü¼ÛÇϴ Ŭ·¡½ºÀÔ´Ï´Ù. ¿À´Ã ½Å°í¸¦ 2¹øÀ̳ª ´çÇß½À´Ï´Ù. ¹Ý¼ºÇÏ´Â Àǹ̷Π¾ÕÀ¸·Î ÀÚ¼÷Çϵµ·Ï ÇϰڽÀ´Ï´Ù. Ãæ¼º~ ¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡ ### °£´Ü ¿¹Á¦ ### // º¯¼ö ¼³Á¤ $host = "www.google.com"; $url = "/test/get.php?a=100"; $cookie = array("b"=>"200","c"=>"300"); // ÇÔ¼ö È£Ãâ $client = new HttpClient($host); if($cookie) $client->setCookies($cookie); // Äí۰¡ ÀÖÀ¸¸é Äí۸¦ ¼³Á¤ÇÑ´Ù. $ret = $client->get($url); // °á°ú ¹Þ±â $pageContents = $client->getContent(); echo "<xmp>$pageContents</xmp>"; ¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡ ### ÷ºÎÆÄÀÏ ¿¹Á¦ ### // º¯¼ö ¼ÂÆÃ $host = "www.google.com"; $url = "/test/upload.php?a=100"; $post = array('p1'=>'Hello', 'p2'=>'World'); $cookie = array('c1'=>'1234', 'c2'=>'5678'); $file = array( array("name"=>"file_1", "path"=>"/var/www/html/upload/a.jpg"), array("name"=>"file_2", "path"=>"/var/www/html/upload/b.jpg") ); // ÇÔ¼ö È£Ãâ $client = new HttpClient($host); if($cookie) $client->setCookies($cookie); $ret = $client->post($url, $post, $file); // Àü¼ÛÇÒ ÆÄÀÏÀÌ ¾ø´Â °æ¿ì $client->post($url, $post); // °á°ú ¹Þ±â $pageContents = $client->getContent(); echo "<xmp>$pageContents</xmp>"; ¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡ ### Âü°í»çÇ× ### ¡Ø Æ÷½ºÆ® µ¥ÀÌÅ͸¦ »ç¿ë ¾ÈÇÒ¶§ : $post = Array(); ¡Ø ÷ºÎ ÆÄÀÏÀ» »ç¿ë ¾ÈÇÒ¶§ : $file = Array(); ¡Ø ÷ºÎÆÄÀÏÀº ¾Æ·¡¿Í °°ÀÌ »ý°¢ÇÏ¸é µÈ´Ù. $file = array( array("name"=>"file_1", "path"=>"/var/www/html/data/play.jpg"), array("name"=>"file_2", "path"=>"/var/www/html/data/boy.jpg") ); * name = INPUT ÇʵåÀÇ nameÀÌ µÈ´Ù. * path = A¼¹ö¿¡¼ B¼¹ö·Î ÆÄÀÏÀ» Àü¼ÛÇÒ¶§ A¼¹ö¿¡ ÆÄÀÏÀÌ ÀúÀåµÈ °æ·Î°¡ µÈ´Ù. <FORM enctype="multipart/form-data" method="post"> <INPUT type=file name="file_1"> <INPUT type=file name="file_2"> </FORM> |
|||||
|
|||||
Àüü´ñ±Û¼ö 7
-


¸í¶ûÆóÀÎ 11-07-27 10:16
¼Ò½ºº¸±â
-
HTTP ÇÁ·ÎÅäÄÝÀ» ÀÌ¿ëÇÏ¿©, ¼¹ö°£ ÆÄÀÏÄ«ÇÇÇÏ´Â ¿¹Á¦±º¿ä.
Àúµµ httpclient¸¦ php¿¡¼ ÀÚÁÖ ¾¹´Ï´Ù. ´Ù¸¥ http Ŭ·¡½ºº¸´Ù ½ÉÇÃÇØ¼ ÁÁ´õ¶ó±¸¿ä.
-

ġŲ·± 11-08-12 10:07
¼Ò½ºº¸±â
- A¼¹ö¿¡¼ B¼¹ö·Î ÆÄÀÏÀ» Àü¼ÛÇÒ¶§... Á˼ÛÇѵ¥ ¾î¶² ¿ëµµÁÒ ? Àß ÀÌÇØ°¡ ¾ÈµÇ´Âµ¥
-


Ä®¼Ø 11-08-12 10:11
¼Ò½ºº¸±â
-
°£´ÜÇÏ°Ô ¿¹¸¦ µé¾î, À̹ÌÁö ¼¹ö¸¦ µû·Î ¿î¿µÇÑ´Ù°í °¡Á¤ÇßÀ»¶§
A¼¹ö¿¡¼ B¼¹ö(À̹ÌÁö)·Î º¹»çÇѴٰųª ÇÏ´Â °æ¿ì¿¡ »ç¿ëÇÒ ¼ö ÀÖ½À´Ï´Ù. -

ġŲ·± 11-08-12 10:40
¼Ò½ºº¸±â
- À½ ±×·¸±º¿ä ... ±Ùµ¥ ftp¸¦ »ç¿ëÇÏÁö ¾Ê°í ÀÌ·¸°Ô ÇÏ´Â ÀÌÀ¯°¡ ÀÖ³ª¿ä ?
-


Ä®¼Ø 11-08-12 11:54
¼Ò½ºº¸±â
- ±×°Ç »ç¿ëÀÚ ¸¶À½ÀÔ´Ï´Ù. ^^;;
12345678910


