[筆記] 網路交換資料方式


Posted by tzutzu858 on 2020-07-13

透過網路交換資料的第一種方式:SOAP

SOAP(Simple Object Access Protocol),即簡單物件存取協定,是交換資料的一種協議規範,使用在計算機網絡Web服務(web service)中,交換帶結構的資訊。

SOAP 資料交換都透過 XML


透過網路交換資料的第二種方式:其他 SOAP 以外的 HTTP API

RESTful 到底是什麼?
它不是一種協定,它是一種風格

before

after

實作 patch
https://github.com/request/request#forms
按照固定它要求的格式,丟一個 request 過去,根據 response 回來去做一些事情,就是串 API

const request = require('request');
request.patch(
  {
    url:'https://reqres.in/api/users/2',
    form:{
      name:'hello'
    }
  },
  function (error, response, body) {
    console.log(response.statusCode);
    console.log(body);
  }
);

透過網路交換資料的第 n 種方式:跳脫 HTTP 的限制

就是自定義


好用工具

curl

指令 : curl <url> 代表下一個 get 的 request,返回 response
因此可以下指令: curl <url> > aaa.html,打開 aaa.html 就是一麼一樣的 html
curl -I <url> -I 的意思是我只要這個 header

好用指令

指令 : nslookup <url>
就可以知道 Domain IP 地址是那些


指令 : ping <url>
測試知道能不能連到那個地方


指令 : telnet 213.247.47.190 80
去 ping 一個指令的 port
Windows 要手動安裝telnet










Related Posts

陣列由小到大排序

陣列由小到大排序

[13] 值 - 字串

[13] 值 - 字串

[ 筆記 ] JavaScript 進階 07 - Prototype Chain

[ 筆記 ] JavaScript 進階 07 - Prototype Chain


Comments