Golfreeze.packetlove.com: Life style of Golfreeze Canon400D Family kammtan.com Jazz Freebsd Unix Linux System Admin guitar Music

All about unix linux freebsd and FAQ for Packetlove.com Web hosting , Mail hosting , VoIP + IP PBX server => All Security via cyber space relate golfreeze task. => Topic started by: golfreeze on สิงหาคม 18, 2014, 03:19:57 PM

Title: เรียนรู้การใช้งาน curl
Post by: golfreeze on สิงหาคม 18, 2014, 03:19:57 PM
http://httpkit.com/resources/HTTP-from-the-Command-Line/ (http://httpkit.com/resources/HTTP-from-the-Command-Line/)

Request :

#curl http://echo.httpkit.com (http://echo.httpkit.com)

Response :

{
  "method": "GET",
  "uri": "/",
  "path": {
    "name": "/",
    "query": "",
    "params": {}
  },
  "headers": {
    "host": "echo.httpkit.com",
    "user-agent": "curl/7.24.0 ...",
    "accept": "*/*"
  },
  "body": null,
  "ip": "28.169.144.35",
  "powered-by": "http://httpkit.com",
  "docs": "http://httpkit.com/echo"
}
Title: Re: เรียนรู้การใช้งาน curl
Post by: golfreeze on สิงหาคม 18, 2014, 04:23:03 PM
To upload a file using the command line, do the following:
Code

curl "http://example.com/upload.php" -F myfile=@"/path/to/file"

Example:
Code

curl "http://example.com/upload.php" -F myfile=@"~/Desktop/image.png"

And using authentication:
Code

curl -u username:password "http://example.com/upload.php" -F myfile=@"~/Desktop/image.png"

NOTE: Change myfile to the file input value name. <input name="myfile" type="file" />
PHP

// upload.php
var_dump($_POST);
var_dump($_FILES);
Title: Re: เรียนรู้การใช้งาน curl
Post by: golfreeze on สิงหาคม 18, 2014, 04:23:43 PM
http://curl.haxx.se/docs/httpscripting.html#Cookie_Basics (http://curl.haxx.se/docs/httpscripting.html#Cookie_Basics)