{"id":250,"date":"2025-02-12T10:05:44","date_gmt":"2025-02-12T01:05:44","guid":{"rendered":"https:\/\/shirakawa.weblike.jp\/blog-page\/?p=250"},"modified":"2025-09-22T11:27:46","modified_gmt":"2025-09-22T02:27:46","slug":"web%e3%82%a2%e3%83%97%e3%83%aa%e3%81%aedebug%e3%81%a7%e4%bd%bf%e3%81%86%e3%82%b3%e3%83%9e%e3%83%b3%e3%83%89","status":"publish","type":"post","link":"https:\/\/shirakawa.weblike.jp\/blog-page\/2025\/02\/12\/web%e3%82%a2%e3%83%97%e3%83%aa%e3%81%aedebug%e3%81%a7%e4%bd%bf%e3%81%86%e3%82%b3%e3%83%9e%e3%83%b3%e3%83%89\/","title":{"rendered":"Web\u30a2\u30d7\u30ea\u306eDebug\u3067\u4f7f\u3046\u30b3\u30de\u30f3\u30c9"},"content":{"rendered":"<p>curl\u30b3\u30de\u30f3\u30c9\u306f\u3001Life with Zaurus https:\/\/seesaawiki.jp\/lifewithslackzaurus\/<br \/>\n\u3067\u306f\u4f7f\u3063\u305f\u4e8b\u304c\u306a\u3044\u3002Web\u30a2\u30d7\u30ea\u7df4\u7fd2\u3067Apach\u52d5\u3044\u3066\u308b\u304b\u30c1\u30a7\u30c3\u30af\u3057\u305f\u304f\u3089\u3044\u3060\u3002\u666e\u6bb5\u306fApach\u30c1\u30a7\u30c3\u30af<br \/>\n\u306a\u3093\u304b\u3057\u306a\u3044\u3002wget\u3084ftp\u306a\u3089\u305f\u307e\u306b\u4f7f\u3046\u304c\u3002\u3088\u304f\u898b\u308b\u3068wget\u3084ftp\u3068\u3082\u3084\u308c\u308b\u4e8b\u304c\u91cd\u306a\u308b\u304c\u3001Web\u30a2\u30d7<br \/>\n\u30ea\u7528\u3089\u3057\u3044\u3002Cygwin\u3067\u3082wget\u3084ftp\u306f\u5165\u308c\u308b\u304c\u3001\u610f\u8b58\u3057\u3066\u306a\u3044\u3068curl\u306f\u307b\u307c\u5165\u308c\u306a\u3044\u3002\u4eca\u5f8c\u306f\u5165\u308c\u3088\u3046\u3002<br \/>\ncurl \u306e\u610f\u5473 &#8211; C: Client\u3001URL: Uniform Resource Locator<br \/>\n\u3064\u307e\u308a\u3001curl \u306f\u300c\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u304cURL\u3092\u64cd\u4f5c\u3059\u308b\u305f\u3081\u306e\u30c4\u30fc\u30eb\u300d\u3068\u3044\u3046\u610f\u5473\u3067\u3059\u3002URL\u3092\u4f7f\u3063\u3066\u30c7\u30fc\u30bf<br \/>\n\u3092\u9001\u53d7\u4fe1\u3059\u308b\u6a5f\u80fd\u3092\u63d0\u4f9b\u3057\u307e\u3059\u3002(-&gt;DeepSeek)<\/p>\n<p>curl\u30b3\u30de\u30f3\u30c9\u3068\u306f\uff1f (-&gt;DeepSeek)<br \/>\n`curl`\u30b3\u30de\u30f3\u30c9\u306f\u3001URL\u3092\u6307\u5b9a\u3057\u3066\u30c7\u30fc\u30bf\u3092\u8ee2\u9001\u3059\u308b\u305f\u3081\u306e\u30b3\u30de\u30f3\u30c9\u30e9\u30a4\u30f3\u30c4\u30fc\u30eb\u3067\u3059\u3002\u4e3b\u306bHTTP\u3001HTTPS\u3001FTP\u3001SFTP\u306a\u3069\u306e\u30d7\u30ed\u30c8\u30b3\u30eb\u3092\u4f7f\u7528\u3057\u3066\u3001\u30b5\u30fc\u30d0\u30fc\u3068\u306e\u9593\u3067\u30c7\u30fc\u30bf\u3092\u9001\u53d7\u4fe1\u3059\u308b\u305f\u3081\u306b\u4f7f\u308f\u308c\u307e\u3059\u3002\u4ee5\u4e0b\u306b\u4e3b\u306a\u7528\u9014\u3068\u57fa\u672c\u7684\u306a\u4f7f\u3044\u65b9\u3092\u8aac\u660e\u3057\u307e\u3059\u3002<br \/>\n### \u4e3b\u306a\u7528\u9014<br \/>\n1. **Web\u30da\u30fc\u30b8\u306e\u53d6\u5f97**: HTTP\/HTTPS\u30ea\u30af\u30a8\u30b9\u30c8\u3092\u9001\u4fe1\u3057\u3066\u3001Web\u30da\u30fc\u30b8\u306eHTML\u3092\u53d6\u5f97\u3059\u308b\u3002<br \/>\n2. **\u30d5\u30a1\u30a4\u30eb\u306e\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\/\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9**: FTP\u3084SFTP\u3092\u4f7f\u7528\u3057\u3066\u30d5\u30a1\u30a4\u30eb\u3092\u8ee2\u9001\u3059\u308b\u3002<br \/>\n3. **API\u3068\u306e\u9023\u643a**: REST API\u306b\u30ea\u30af\u30a8\u30b9\u30c8\u3092\u9001\u4fe1\u3057\u3001JSON\u3084XML\u5f62\u5f0f\u306e\u30c7\u30fc\u30bf\u3092\u53d6\u5f97\u3059\u308b\u3002<br \/>\n4. **\u30d8\u30c3\u30c0\u30fc\u60c5\u5831\u306e\u78ba\u8a8d**: HTTP\u30ec\u30b9\u30dd\u30f3\u30b9\u306e\u30d8\u30c3\u30c0\u30fc\u60c5\u5831\u3092\u78ba\u8a8d\u3059\u308b\u3002<br \/>\n5. **\u30c7\u30fc\u30bf\u306e\u9001\u4fe1**: POST\u30ea\u30af\u30a8\u30b9\u30c8\u3067\u30d5\u30a9\u30fc\u30e0\u30c7\u30fc\u30bf\u3084JSON\u30c7\u30fc\u30bf\u3092\u9001\u4fe1\u3059\u308b\u3002<br \/>\n### \u57fa\u672c\u7684\u306a\u4f7f\u3044\u65b9<br \/>\n$ curl [\u30aa\u30d7\u30b7\u30e7\u30f3] [URL]<br \/>\n### \u3088\u304f\u4f7f\u308f\u308c\u308b\u30aa\u30d7\u30b7\u30e7\u30f3<br \/>\n\\- `-o &lt;\u30d5\u30a1\u30a4\u30eb\u540d&gt;`: \u51fa\u529b\u3092\u30d5\u30a1\u30a4\u30eb\u306b\u4fdd\u5b58\u3059\u308b\u3002<br \/>\n\\- `-O`: \u30ea\u30e2\u30fc\u30c8\u30d5\u30a1\u30a4\u30eb\u540d\u3067\u4fdd\u5b58\u3059\u308b\u3002<br \/>\n\\- `-I`: \u30d8\u30c3\u30c0\u30fc\u60c5\u5831\u306e\u307f\u3092\u53d6\u5f97\u3059\u308b\u3002<br \/>\n\\- `-X &lt;\u30e1\u30bd\u30c3\u30c9&gt;`: HTTP\u30e1\u30bd\u30c3\u30c9\u3092\u6307\u5b9a\u3059\u308b\uff08\u4f8b: GET, POST\uff09\u3002<br \/>\n\\- `-d &lt;\u30c7\u30fc\u30bf&gt;`: POST\u30ea\u30af\u30a8\u30b9\u30c8\u3067\u30c7\u30fc\u30bf\u3092\u9001\u4fe1\u3059\u308b\u3002<br \/>\n\\- `-H &lt;\u30d8\u30c3\u30c0\u30fc&gt;`: \u30ab\u30b9\u30bf\u30e0\u30d8\u30c3\u30c0\u30fc\u3092\u8ffd\u52a0\u3059\u308b\u3002<br \/>\n\\- `-u &lt;\u30e6\u30fc\u30b6\u30fc\u540d:\u30d1\u30b9\u30ef\u30fc\u30c9&gt;`: \u30d9\u30fc\u30b7\u30c3\u30af\u8a8d\u8a3c\u3092\u4f7f\u7528\u3059\u308b\u3002<br \/>\n\\- `-v`: \u8a73\u7d30\u306a\u60c5\u5831\u3092\u8868\u793a\u3059\u308b\uff08\u30c7\u30d0\u30c3\u30b0\u7528\uff09\u3002<br \/>\n### \u4f7f\u7528\u4f8b<br \/>\n1. **Web\u30da\u30fc\u30b8\u306e\u53d6\u5f97**:<br \/>\n$ curl https:\/\/example.com<br \/>\n2. **\u30d5\u30a1\u30a4\u30eb\u306e\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9**:<br \/>\n$ curl -O https:\/\/example.com\/file.zip<br \/>\n3. **API\u30ea\u30af\u30a8\u30b9\u30c8\u306e\u9001\u4fe1**:<br \/>\n$ curl -X POST -H &#8220;Content-Type: application\/json&#8221; -d &#8216;{&#8220;key&#8221;:&#8221;value&#8221;}&#8217; https:\/\/api.example.com\/endpoint<br \/>\n4. **\u30d8\u30c3\u30c0\u30fc\u60c5\u5831\u306e\u78ba\u8a8d**:<br \/>\n$ curl -I https:\/\/example.com<br \/>\n5. **\u30d5\u30a1\u30a4\u30eb\u306e\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9**:<br \/>\n$ curl -T file.txt ftp:\/\/example.com\/upload\/<br \/>\n\\<br \/>\n`curl`\u306f\u975e\u5e38\u306b\u67d4\u8edf\u3067\u3001\u3055\u307e\u3056\u307e\u306a\u7528\u9014\u306b\u4f7f\u7528\u3067\u304d\u308b\u5f37\u529b\u306a\u30c4\u30fc\u30eb\u3067\u3059\u3002\u8a73\u7d30\u306f`man curl`\u3084`curl &#8211;help`\u3067\u78ba\u8a8d\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>curl\u30b3\u30de\u30f3\u30c9\u306f\u3001Web\u30a2\u30d7\u30ea\u306eDebug\u306b\u3088\u304f\u4f7f\u308f\u308c\u308b\uff1f (-&gt;DeepSeek)<br \/>\n\u306f\u3044\u3001`curl`\u30b3\u30de\u30f3\u30c9\u306fWeb\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u30c7\u30d0\u30c3\u30b0\u306b\u3088\u304f\u4f7f\u308f\u308c\u307e\u3059\u3002\u7279\u306bAPI\u3084Web\u30b5\u30fc\u30d0\u30fc\u306e\u52d5\u4f5c\u78ba\u8a8d\u3001\u30ec\u30b9\u30dd\u30f3\u30b9\u306e\u691c\u8a3c\u3001\u30ea\u30af\u30a8\u30b9\u30c8\u306e\u30c6\u30b9\u30c8\u306a\u3069\u306b\u975e\u5e38\u306b\u4fbf\u5229\u3067\u3059\u3002\u4ee5\u4e0b\u306b\u3001`curl`\u304cWeb\u30a2\u30d7\u30ea\u306e\u30c7\u30d0\u30c3\u30b0\u3067\u3069\u306e\u3088\u3046\u306b\u6d3b\u7528\u3055\u308c\u308b\u304b\u3092\u5177\u4f53\u7684\u306b\u8aac\u660e\u3057\u307e\u3059\u3002<br \/>\n### **1. API\u306e\u52d5\u4f5c\u78ba\u8a8d**<br \/>\nAPI\u30a8\u30f3\u30c9\u30dd\u30a4\u30f3\u30c8\u306b\u5bfe\u3057\u3066\u30ea\u30af\u30a8\u30b9\u30c8\u3092\u9001\u4fe1\u3057\u3001\u30ec\u30b9\u30dd\u30f3\u30b9\u3092\u78ba\u8a8d\u3059\u308b\u305f\u3081\u306b\u4f7f\u308f\u308c\u307e\u3059\u3002\u4f8b\u3048\u3070\u3001REST API\u306e\u30c7\u30d0\u30c3\u30b0\u3067\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u3053\u3068\u304c\u53ef\u80fd\u3067\u3059\u3002<br \/>\n\\- **GET\u30ea\u30af\u30a8\u30b9\u30c8**:<br \/>\n$ curl https:\/\/api.example.com\/users<br \/>\n\u3053\u306e\u30b3\u30de\u30f3\u30c9\u3067\u3001\u30e6\u30fc\u30b6\u30fc\u4e00\u89a7\u3092\u53d6\u5f97\u3059\u308bAPI\u306e\u30ec\u30b9\u30dd\u30f3\u30b9\u3092\u78ba\u8a8d\u3067\u304d\u307e\u3059\u3002<br \/>\n\\- **POST\u30ea\u30af\u30a8\u30b9\u30c8**:<br \/>\n$ curl -X POST -H &#8220;Content-Type: application\/json&#8221; -d &#8216;{&#8220;name&#8221;:&#8221;John&#8221;, &#8220;age&#8221;:30}&#8217; https:\/\/api.example.com\/users<br \/>\n\u3053\u306e\u30b3\u30de\u30f3\u30c9\u3067\u3001\u65b0\u3057\u3044\u30e6\u30fc\u30b6\u30fc\u3092\u4f5c\u6210\u3059\u308bAPI\u306e\u52d5\u4f5c\u3092\u30c6\u30b9\u30c8\u3067\u304d\u307e\u3059\u3002<br \/>\n\\- **\u30ec\u30b9\u30dd\u30f3\u30b9\u306e\u8a73\u7d30\u78ba\u8a8d**:<br \/>\n$ curl -i https:\/\/api.example.com\/users<br \/>\n`-i`\u30aa\u30d7\u30b7\u30e7\u30f3\u3092\u4f7f\u3046\u3068\u3001HTTP\u30d8\u30c3\u30c0\u30fc\u3068\u30dc\u30c7\u30a3\u3092\u4e00\u7dd2\u306b\u78ba\u8a8d\u3067\u304d\u307e\u3059\u3002<br \/>\n### **2. \u30d8\u30c3\u30c0\u30fc\u306e\u78ba\u8a8d**<br \/>\nWeb\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u30c7\u30d0\u30c3\u30b0\u3067\u306f\u3001HTTP\u30d8\u30c3\u30c0\u30fc\u304c\u6b63\u3057\u304f\u8a2d\u5b9a\u3055\u308c\u3066\u3044\u308b\u304b\u3092\u78ba\u8a8d\u3059\u308b\u3053\u3068\u304c\u91cd\u8981\u3067\u3059\u3002`curl`\u3092\u4f7f\u3046\u3068\u3001\u30ec\u30b9\u30dd\u30f3\u30b9\u30d8\u30c3\u30c0\u30fc\u3092\u7c21\u5358\u306b\u78ba\u8a8d\u3067\u304d\u307e\u3059\u3002<br \/>\n\\- **\u30d8\u30c3\u30c0\u30fc\u306e\u307f\u78ba\u8a8d**:<br \/>\n$ curl -I https:\/\/example.com<br \/>\n\u3053\u306e\u30b3\u30de\u30f3\u30c9\u3067\u3001\u30b5\u30fc\u30d0\u30fc\u304c\u8fd4\u3059HTTP\u30d8\u30c3\u30c0\u30fc\uff08\u30b9\u30c6\u30fc\u30bf\u30b9\u30b3\u30fc\u30c9\u3001Content-Type\u3001Cache-Control\u306a\u3069\uff09\u3092\u78ba\u8a8d\u3067\u304d\u307e\u3059\u3002<br \/>\n\\- **\u30ab\u30b9\u30bf\u30e0\u30d8\u30c3\u30c0\u30fc\u306e\u9001\u4fe1**:<br \/>\n$ curl -H &#8220;Authorization: Bearer token123&#8221; https:\/\/api.example.com\/protected<br \/>\n\u3053\u306e\u3088\u3046\u306b\u3001\u8a8d\u8a3c\u30c8\u30fc\u30af\u30f3\u3084\u30ab\u30b9\u30bf\u30e0\u30d8\u30c3\u30c0\u30fc\u3092\u9001\u4fe1\u3057\u3066\u3001\u30b5\u30fc\u30d0\u30fc\u306e\u6319\u52d5\u3092\u30c6\u30b9\u30c8\u3067\u304d\u307e\u3059\u3002<br \/>\n### **3. \u30a8\u30e9\u30fc\u306e\u7279\u5b9a**<br \/>\nWeb\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3067\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u305f\u5834\u5408\u3001`curl`\u3092\u4f7f\u3063\u3066\u30ea\u30af\u30a8\u30b9\u30c8\u3092\u518d\u73fe\u3057\u3001\u30a8\u30e9\u30fc\u306e\u539f\u56e0\u3092\u7279\u5b9a\u3067\u304d\u307e\u3059\u3002<br \/>\n\\- **\u8a73\u7d30\u306a\u30ed\u30b0\u306e\u8868\u793a**:<br \/>\n$ curl -v https:\/\/example.com<br \/>\n`-v`\u30aa\u30d7\u30b7\u30e7\u30f3\u3092\u4f7f\u3046\u3068\u3001\u30ea\u30af\u30a8\u30b9\u30c8\u3068\u30ec\u30b9\u30dd\u30f3\u30b9\u306e\u8a73\u7d30\u306a\u60c5\u5831\u304c\u8868\u793a\u3055\u308c\u307e\u3059\u3002\u3053\u308c\u306b\u3088\u308a\u3001\u30ea\u30af\u30a8\u30b9\u30c8\u304c\u6b63\u3057\u304f\u9001\u4fe1\u3055\u308c\u3066\u3044\u308b\u304b\u3001\u30b5\u30fc\u30d0\u30fc\u304c\u3069\u306e\u3088\u3046\u306a\u30ec\u30b9\u30dd\u30f3\u30b9\u3092\u8fd4\u3057\u3066\u3044\u308b\u304b\u3092\u78ba\u8a8d\u3067\u304d\u307e\u3059\u3002<br \/>\n\\- **\u30b9\u30c6\u30fc\u30bf\u30b9\u30b3\u30fc\u30c9\u306e\u78ba\u8a8d**:<br \/>\n$ curl -o \/dev\/null -s -w &#8220;%{http_code}\\n&#8221; https:\/\/example.com<br \/>\n\u3053\u306e\u30b3\u30de\u30f3\u30c9\u3067\u3001HTTP\u30b9\u30c6\u30fc\u30bf\u30b9\u30b3\u30fc\u30c9\u306e\u307f\u3092\u53d6\u5f97\u3067\u304d\u307e\u3059\u3002\u4f8b\u3048\u3070\u3001`404`\uff08Not Found\uff09\u3084`500`\uff08Internal Server Error\uff09\u306a\u3069\u306e\u30a8\u30e9\u30fc\u3092\u7c21\u5358\u306b\u78ba\u8a8d\u3067\u304d\u307e\u3059\u3002<br \/>\n### **4. \u30bb\u30c3\u30b7\u30e7\u30f3\u3084Cookie\u306e\u30c6\u30b9\u30c8**<br \/>\nWeb\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3067\u306f\u3001\u30bb\u30c3\u30b7\u30e7\u30f3\u3084Cookie\u3092\u4f7f\u3063\u305f\u8a8d\u8a3c\u304c\u3088\u304f\u4f7f\u308f\u308c\u307e\u3059\u3002`curl`\u3092\u4f7f\u3046\u3068\u3001Cookie\u3092\u9001\u4fe1\u3057\u305f\u308a\u3001\u30ec\u30b9\u30dd\u30f3\u30b9\u304b\u3089Cookie\u3092\u4fdd\u5b58\u3057\u305f\u308a\u3067\u304d\u307e\u3059\u3002<br \/>\n\\- **Cookie\u306e\u9001\u4fe1**:<br \/>\n$ curl -b &#8220;sessionid=abc123&#8221; https:\/\/example.com\/dashboard<br \/>\n\u3053\u306e\u30b3\u30de\u30f3\u30c9\u3067\u3001\u7279\u5b9a\u306e\u30bb\u30c3\u30b7\u30e7\u30f3ID\u3092\u4f7f\u3063\u3066\u30ea\u30af\u30a8\u30b9\u30c8\u3092\u9001\u4fe1\u3067\u304d\u307e\u3059\u3002<br \/>\n\\- **Cookie\u306e\u4fdd\u5b58\u3068\u518d\u5229\u7528**:<br \/>\n$ curl -c cookies.txt https:\/\/example.com\/login<br \/>\n$ curl -b cookies.txt https:\/\/example.com\/dashboard<br \/>\n1\u3064\u76ee\u306e\u30b3\u30de\u30f3\u30c9\u3067\u30ed\u30b0\u30a4\u30f3\u3057\u3066Cookie\u3092\u4fdd\u5b58\u3057\u30012\u3064\u76ee\u306e\u30b3\u30de\u30f3\u30c9\u3067\u4fdd\u5b58\u3057\u305fCookie\u3092\u4f7f\u3063\u3066\u30c0\u30c3\u30b7\u30e5\u30dc\u30fc\u30c9\u306b\u30a2\u30af\u30bb\u30b9\u3067\u304d\u307e\u3059\u3002<br \/>\n### **5. \u30d5\u30a1\u30a4\u30eb\u306e\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3084\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u306e\u30c6\u30b9\u30c8**<br \/>\nWeb\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3067\u30d5\u30a1\u30a4\u30eb\u306e\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3084\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u6a5f\u80fd\u3092\u30c7\u30d0\u30c3\u30b0\u3059\u308b\u5834\u5408\u306b\u3082`curl`\u304c\u5f79\u7acb\u3061\u307e\u3059\u3002<br \/>\n\\- **\u30d5\u30a1\u30a4\u30eb\u306e\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9**:<br \/>\n$ curl -F &#8220;file=@\/path\/to\/file.txt&#8221; https:\/\/example.com\/upload<br \/>\n\u3053\u306e\u30b3\u30de\u30f3\u30c9\u3067\u3001\u30d5\u30a1\u30a4\u30eb\u3092\u30b5\u30fc\u30d0\u30fc\u306b\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3067\u304d\u307e\u3059\u3002<br \/>\n\\- **\u30d5\u30a1\u30a4\u30eb\u306e\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9**:<br \/>\n$ curl -O https:\/\/example.com\/file.txt<br \/>\n\u3053\u306e\u30b3\u30de\u30f3\u30c9\u3067\u3001\u30b5\u30fc\u30d0\u30fc\u304b\u3089\u30d5\u30a1\u30a4\u30eb\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3067\u304d\u307e\u3059\u3002<br \/>\n### **6. \u30ea\u30c0\u30a4\u30ec\u30af\u30c8\u306e\u78ba\u8a8d**<br \/>\nWeb\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3067\u30ea\u30c0\u30a4\u30ec\u30af\u30c8\u304c\u6b63\u3057\u304f\u52d5\u4f5c\u3057\u3066\u3044\u308b\u304b\u3092\u78ba\u8a8d\u3059\u308b\u305f\u3081\u306b\u3082`curl`\u304c\u4f7f\u308f\u308c\u307e\u3059\u3002<br \/>\n\\- **\u30ea\u30c0\u30a4\u30ec\u30af\u30c8\u306e\u8ffd\u8de1**:<br \/>\n$ curl -L https:\/\/example.com<br \/>\n`-L`\u30aa\u30d7\u30b7\u30e7\u30f3\u3092\u4f7f\u3046\u3068\u3001\u30ea\u30c0\u30a4\u30ec\u30af\u30c8\u5148\u3092\u81ea\u52d5\u7684\u306b\u8ffd\u8de1\u3057\u307e\u3059\u3002<br \/>\n### **7. \u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u306e\u7c21\u6613\u6e2c\u5b9a**<br \/>\n`curl`\u3092\u4f7f\u3046\u3068\u3001\u30ea\u30af\u30a8\u30b9\u30c8\u306e\u5fdc\u7b54\u6642\u9593\u3092\u7c21\u5358\u306b\u8a08\u6e2c\u3067\u304d\u307e\u3059\u3002<br \/>\n\\- **\u5fdc\u7b54\u6642\u9593\u306e\u8a08\u6e2c**:<br \/>\n$ curl -o \/dev\/null -s -w &#8220;Response Time: %{time_total}\\n&#8221; https:\/\/example.com<br \/>\n\u3053\u306e\u30b3\u30de\u30f3\u30c9\u3067\u3001\u30ea\u30af\u30a8\u30b9\u30c8\u306e\u5408\u8a08\u6642\u9593\u3092\u8a08\u6e2c\u3067\u304d\u307e\u3059\u3002<br \/>\n### **\u307e\u3068\u3081**<br \/>\n`curl`\u306f\u3001Web\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u30c7\u30d0\u30c3\u30b0\u306b\u304a\u3044\u3066\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u5834\u9762\u3067\u975e\u5e38\u306b\u6709\u7528\u3067\u3059\uff1a<br \/>\n\\- API\u306e\u52d5\u4f5c\u78ba\u8a8d<br \/>\n\\- \u30d8\u30c3\u30c0\u30fc\u3084Cookie\u306e\u30c6\u30b9\u30c8<br \/>\n\\- \u30a8\u30e9\u30fc\u306e\u7279\u5b9a<br \/>\n\\- \u30d5\u30a1\u30a4\u30eb\u306e\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\/\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u306e\u30c6\u30b9\u30c8<br \/>\n\\- \u30ea\u30c0\u30a4\u30ec\u30af\u30c8\u3084\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u306e\u78ba\u8a8d<br \/>\n\u7279\u306b\u3001GUI\u30c4\u30fc\u30eb\u304c\u4f7f\u3048\u306a\u3044\u74b0\u5883\uff08\u4f8b: \u30b5\u30fc\u30d0\u30fc\u4e0a\u306e\u30b7\u30a7\u30eb\uff09\u3084\u3001\u81ea\u52d5\u5316\u30b9\u30af\u30ea\u30d7\u30c8\u3067\u306e\u5229\u7528\u306b\u9069\u3057\u3066\u3044\u307e\u3059\u3002`curl`\u3092\u4f7f\u3044\u3053\u306a\u3059\u3053\u3068\u3067\u3001Web\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u30c7\u30d0\u30c3\u30b0\u52b9\u7387\u304c\u5927\u5e45\u306b\u5411\u4e0a\u3057\u307e\u3059\u3002<\/p>\n<p>curl\u30b3\u30de\u30f3\u30c9\u306f\u3001Web\u30a2\u30d7\u30ea\u306eDebug\u306b\u3088\u304f\u4f7f\u308f\u308c\u308b\uff1f (-&gt;ChatGPT)<br \/>\n\u306f\u3044\u3001`curl` \u30b3\u30de\u30f3\u30c9\u306f Web \u30a2\u30d7\u30ea\u306e\u30c7\u30d0\u30c3\u30b0\u306b\u3088\u304f\u4f7f\u308f\u308c\u307e\u3059\u3002\u7279\u306b\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u5834\u9762\u3067\u5f79\u7acb\u3061\u307e\u3059\u3002<br \/>\n### 1. **API \u306e\u30c6\u30b9\u30c8**<br \/>\n\\ &#8211; REST API \u306e\u30a8\u30f3\u30c9\u30dd\u30a4\u30f3\u30c8\u3092\u30c6\u30b9\u30c8\u3059\u308b\u306e\u306b\u4fbf\u5229\u3067\u3059\u3002<br \/>\n\\ &#8211; `GET`\u3001`POST`\u3001`PUT`\u3001`DELETE` \u306a\u3069\u306e\u30ea\u30af\u30a8\u30b9\u30c8\u3092\u7c21\u5358\u306b\u9001\u4fe1\u3067\u304d\u307e\u3059\u3002<br \/>\n$ curl -X GET https:\/\/api.example.com\/users\/1<br \/>\n\\ JSON \u30c7\u30fc\u30bf\u3092\u9001\u4fe1\u3059\u308b\u5834\u5408:<br \/>\n$ curl -X POST https:\/\/api.example.com\/users -H &#8220;Content-Type: application\/json&#8221; -d &#8216;{&#8220;name&#8221;: &#8220;Taro&#8221;, &#8220;email&#8221;: &#8220;taro@example.com&#8221;}&#8217;<br \/>\n### 2. **HTTP \u30d8\u30c3\u30c0\u30fc\u306e\u78ba\u8a8d**<br \/>\n\\ &#8211; \u30b5\u30fc\u30d0\u30fc\u304c\u3069\u306e\u3088\u3046\u306a\u30ec\u30b9\u30dd\u30f3\u30b9\u3092\u8fd4\u3057\u3066\u3044\u308b\u304b\u78ba\u8a8d\u3067\u304d\u307e\u3059\u3002<br \/>\n$ curl -I https:\/\/example.com<br \/>\n\\ **\u51fa\u529b\u4f8b:**<br \/>\n\\ HTTP\/1.1 200 OK<br \/>\n\\ Content-Type: text\/html; charset=UTF-8<br \/>\n\\ Server: Apache<br \/>\n### 3. **\u30ea\u30c0\u30a4\u30ec\u30af\u30c8\u306e\u78ba\u8a8d**<br \/>\n\\ &#8211; `-L` \u30aa\u30d7\u30b7\u30e7\u30f3\u3092\u4f7f\u3046\u3068\u3001\u30ea\u30c0\u30a4\u30ec\u30af\u30c8\u3092\u305f\u3069\u308c\u307e\u3059\u3002<br \/>\n$ curl -L https:\/\/example.com<br \/>\n### 4. **\u30a8\u30e9\u30fc\u30ec\u30b9\u30dd\u30f3\u30b9\u306e\u78ba\u8a8d**<br \/>\n\\ &#8211; Web \u30a2\u30d7\u30ea\u304c\u7279\u5b9a\u306e\u30a8\u30e9\u30fc\u3092\u8fd4\u3059\u304b\u30c1\u30a7\u30c3\u30af\u3067\u304d\u307e\u3059\u3002<br \/>\n$ curl -v https:\/\/example.com\/nonexistent-page<br \/>\n### 5. **\u8a8d\u8a3c\u4ed8\u304d API \u306e\u30c6\u30b9\u30c8**<br \/>\n\\ &#8211; `Authorization` \u30d8\u30c3\u30c0\u30fc\u3092\u4ed8\u4e0e\u3057\u3066\u8a8d\u8a3c\u304c\u5fc5\u8981\u306a API \u3092\u30c6\u30b9\u30c8\u3067\u304d\u307e\u3059\u3002<br \/>\n$ curl -X GET https:\/\/api.example.com\/protected -H &#8220;Authorization: Bearer YOUR_ACCESS_TOKEN&#8221;<br \/>\n### 6. **\u30d7\u30ed\u30ad\u30b7\u7d4c\u7531\u3067\u306e\u901a\u4fe1**<br \/>\n\\ &#8211; `-x` \u30aa\u30d7\u30b7\u30e7\u30f3\u3092\u4f7f\u3046\u3068\u3001\u30d7\u30ed\u30ad\u30b7\u7d4c\u7531\u306e\u30ea\u30af\u30a8\u30b9\u30c8\u3082\u53ef\u80fd\u3002<br \/>\n$ curl -x http:\/\/proxy.example.com:8080 https:\/\/example.com<br \/>\n### 7. **\u30d5\u30a9\u30fc\u30e0\u306e\u9001\u4fe1**<br \/>\n\\ &#8211; `&#8211;data` \u3092\u4f7f\u3048\u3070\u3001Web \u30d5\u30a9\u30fc\u30e0\u3092\u30a8\u30df\u30e5\u30ec\u30fc\u30c8\u3067\u304d\u307e\u3059\u3002<br \/>\n$ curl -X POST https:\/\/example.com\/login -d &#8220;username=user&amp;password=pass&#8221;<br \/>\n### 8. **\u30d5\u30a1\u30a4\u30eb\u306e\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9**<br \/>\n\\ &#8211; `-F` \u30aa\u30d7\u30b7\u30e7\u30f3\u3067\u30d5\u30a9\u30fc\u30e0\u7d4c\u7531\u306e\u30d5\u30a1\u30a4\u30eb\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3082\u53ef\u80fd\u3002<br \/>\n$ curl -X POST https:\/\/example.com\/upload -F &#8220;file=@\/path\/to\/file.jpg&#8221;<br \/>\n### **\u307e\u3068\u3081**<br \/>\n\\- `curl` \u306f API \u306e\u30c7\u30d0\u30c3\u30b0\u3001\u30b5\u30fc\u30d0\u30fc\u30ec\u30b9\u30dd\u30f3\u30b9\u306e\u78ba\u8a8d\u3001\u30a8\u30e9\u30fc\u30cf\u30f3\u30c9\u30ea\u30f3\u30b0\u306e\u30c1\u30a7\u30c3\u30af\u306a\u3069\u3001\u591a\u304f\u306e\u5834\u9762\u3067\u5f79\u7acb\u3064\u30c4\u30fc\u30eb\u3002<br \/>\n\\- \u7279\u306b **REST API \u306e\u958b\u767a** \u3084 **\u30b5\u30fc\u30d0\u30fc\u8a2d\u5b9a\u306e\u78ba\u8a8d** \u306b\u304a\u3044\u3066\u983b\u7e41\u306b\u4f7f\u308f\u308c\u308b\u3002<br \/>\nWeb \u30a2\u30d7\u30ea\u306e\u30c7\u30d0\u30c3\u30b0\u3092\u3059\u308b\u3068\u304d\u306b\u3001\u7279\u306b\u3069\u3093\u306a\u554f\u984c\u3092\u30c1\u30a7\u30c3\u30af\u3057\u305f\u3044\u3067\u3059\u304b\uff1f<\/p>\n<p>\/*************************************************************************************\/<br \/>\n\u4ed6\u306bcurl\u4ee5\u5916\u306bWeb\u30a2\u30d7\u30ea\u306eDebug\u306b\u3088\u304f\u4f7f\u308f\u308c\u308bLinux\u30b3\u30de\u30f3\u30c9\u306f\u3042\u308b\u304b\uff1f<\/p>\n<p>\/*************************************************************************************\/<\/p>\n<p>&nbsp;<br \/>\n\u53c2\u8003\u60c5\u5831\uff1a<\/p>\n","protected":false},"excerpt":{"rendered":"<p>curl\u30b3\u30de\u30f3\u30c9\u306f\u3001Life with Zaurus https:\/\/seesaawiki.jp\/lifewithslackzaurus\/ \u3067\u306f\u4f7f\u3063\u305f\u4e8b\u304c\u306a\u3044\u3002Web\u30a2\u30d7\u30ea\u7df4\u7fd2\u3067Apach\u52d5\u3044\u3066\u308b\u304b\u30c1\u30a7\u30c3\u30af\u3057\u305f\u304f\u3089\u3044\u3060\u3002 [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"class_list":["post-250","post","type-post","status-publish","format-standard","hentry","category-web-practice"],"_links":{"self":[{"href":"https:\/\/shirakawa.weblike.jp\/blog-page\/wp-json\/wp\/v2\/posts\/250","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/shirakawa.weblike.jp\/blog-page\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/shirakawa.weblike.jp\/blog-page\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/shirakawa.weblike.jp\/blog-page\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/shirakawa.weblike.jp\/blog-page\/wp-json\/wp\/v2\/comments?post=250"}],"version-history":[{"count":3,"href":"https:\/\/shirakawa.weblike.jp\/blog-page\/wp-json\/wp\/v2\/posts\/250\/revisions"}],"predecessor-version":[{"id":1681,"href":"https:\/\/shirakawa.weblike.jp\/blog-page\/wp-json\/wp\/v2\/posts\/250\/revisions\/1681"}],"wp:attachment":[{"href":"https:\/\/shirakawa.weblike.jp\/blog-page\/wp-json\/wp\/v2\/media?parent=250"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/shirakawa.weblike.jp\/blog-page\/wp-json\/wp\/v2\/categories?post=250"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/shirakawa.weblike.jp\/blog-page\/wp-json\/wp\/v2\/tags?post=250"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}