curl -X POST \
http://api.toolfk.com/api/article \
-H 'Content-Type: application/x-www-form-urlencoded' \
-d 'token=用户中心获取&content=%E6%AC%A2%E8%BF%8E%E6%9D%A5%E5%88%B0TOOLFK%E5%B7%A5%E5%85%B7%E7%BD%91%2C%E5%A6%82%E6%9E%9C%E6%82%A8%E8%A7%89%E5%BE%97%E8%BF%98%E4%B8%8D%E9%94%99%2C%E9%BA%BB%E7%83%A6%E7%82%B9%E5%87%BB%E4%B8%8A%E9%9D%A2%E7%9A%84%E5%88%86%E4%BA%AB%E6%8C%89%E9%92%AE%E5%88%86%E4%BA%AB%E7%BB%99%E6%82%A8%E7%9A%84%E6%9C%8B%E5%8F%8B%2C%E6%84%9F%E8%B0%A2%21'
//记得去掉这个 "\" 斜线
<\?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "http://api.toolfk.com/api/article",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "token=用户中心获取&content=%E6%AC%A2%E8%BF%8E%E6%9D%A5%E5%88%B0TOOLFK%E5%B7%A5%E5%85%B7%E7%BD%91%2C%E5%A6%82%E6%9E%9C%E6%82%A8%E8%A7%89%E5%BE%97%E8%BF%98%E4%B8%8D%E9%94%99%2C%E9%BA%BB%E7%83%A6%E7%82%B9%E5%87%BB%E4%B8%8A%E9%9D%A2%E7%9A%84%E5%88%86%E4%BA%AB%E6%8C%89%E9%92%AE%E5%88%86%E4%BA%AB%E7%BB%99%E6%82%A8%E7%9A%84%E6%9C%8B%E5%8F%8B%2C%E6%84%9F%E8%B0%A2%21",
CURLOPT_HTTPHEADER => array(
"Content-Type: application/x-www-form-urlencoded",
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded");
RequestBody body = RequestBody.create(mediaType, "token=用户中心获取&content=%E6%AC%A2%E8%BF%8E%E6%9D%A5%E5%88%B0TOOLFK%E5%B7%A5%E5%85%B7%E7%BD%91%2C%E5%A6%82%E6%9E%9C%E6%82%A8%E8%A7%89%E5%BE%97%E8%BF%98%E4%B8%8D%E9%94%99%2C%E9%BA%BB%E7%83%A6%E7%82%B9%E5%87%BB%E4%B8%8A%E9%9D%A2%E7%9A%84%E5%88%86%E4%BA%AB%E6%8C%89%E9%92%AE%E5%88%86%E4%BA%AB%E7%BB%99%E6%82%A8%E7%9A%84%E6%9C%8B%E5%8F%8B%2C%E6%84%9F%E8%B0%A2%21");
Request request = new Request.Builder()
.url("http://api.toolfk.com/api/article")
.post(body)
.addHeader("Content-Type", "application/x-www-form-urlencoded")
.build();
Response response = client.newCall(request).execute();
import requests
url = "http://api.toolfk.com/api/article"
payload = "token=用户中心获取&content=%E6%AC%A2%E8%BF%8E%E6%9D%A5%E5%88%B0TOOLFK%E5%B7%A5%E5%85%B7%E7%BD%91%2C%E5%A6%82%E6%9E%9C%E6%82%A8%E8%A7%89%E5%BE%97%E8%BF%98%E4%B8%8D%E9%94%99%2C%E9%BA%BB%E7%83%A6%E7%82%B9%E5%87%BB%E4%B8%8A%E9%9D%A2%E7%9A%84%E5%88%86%E4%BA%AB%E6%8C%89%E9%92%AE%E5%88%86%E4%BA%AB%E7%BB%99%E6%82%A8%E7%9A%84%E6%9C%8B%E5%8F%8B%2C%E6%84%9F%E8%B0%A2%21"
headers = {'Content-Type': "application/x-www-form-urlencoded"}
response = requests.request("POST", url, data=payload, headers=headers)
print(response.text)
var data = "token=用户中心获取&content=%E6%AC%A2%E8%BF%8E%E6%9D%A5%E5%88%B0TOOLFK%E5%B7%A5%E5%85%B7%E7%BD%91%2C%E5%A6%82%E6%9E%9C%E6%82%A8%E8%A7%89%E5%BE%97%E8%BF%98%E4%B8%8D%E9%94%99%2C%E9%BA%BB%E7%83%A6%E7%82%B9%E5%87%BB%E4%B8%8A%E9%9D%A2%E7%9A%84%E5%88%86%E4%BA%AB%E6%8C%89%E9%92%AE%E5%88%86%E4%BA%AB%E7%BB%99%E6%82%A8%E7%9A%84%E6%9C%8B%E5%8F%8B%2C%E6%84%9F%E8%B0%A2%21";
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function () {
if (this.readyState === 4) {
console.log(this.responseText);
}
});
xhr.open("POST", "http://api.toolfk.com/api/article");
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.send(data);
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "http://api.toolfk.com/api/article"
payload := strings.NewReader("token=用户中心获取&content=%E6%AC%A2%E8%BF%8E%E6%9D%A5%E5%88%B0TOOLFK%E5%B7%A5%E5%85%B7%E7%BD%91%2C%E5%A6%82%E6%9E%9C%E6%82%A8%E8%A7%89%E5%BE%97%E8%BF%98%E4%B8%8D%E9%94%99%2C%E9%BA%BB%E7%83%A6%E7%82%B9%E5%87%BB%E4%B8%8A%E9%9D%A2%E7%9A%84%E5%88%86%E4%BA%AB%E6%8C%89%E9%92%AE%E5%88%86%E4%BA%AB%E7%BB%99%E6%82%A8%E7%9A%84%E6%9C%8B%E5%8F%8B%2C%E6%84%9F%E8%B0%A2%21")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
res, _ := http.DefaultClient.Do(req)
async res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "http://api.toolfk.com/api/article"
payload := strings.NewReader("{
"token": "用户中心获取token",
"type": "a",
"format": "json"
}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
res, _ := http.DefaultClient.Do(req)
async res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}