功能介绍
奶盘伪原创API是奶盘网为第三方开发人员提供的编程接口。
以往需要复制文章到奶盘网,伪原创后再粘贴到您要发布的网站。现在奶盘开放了API,只要整合到您的网站,在您发布文章时,自动帮您做过奶盘伪原创,节省您的时间,让您更好的用于网站维护!更强大的功能是奶盘开发的API还支持用户自定义词库和关键字加链接的功能。
API请求地址
环境 |
请求方法 |
HTTP请求地址 |
正式环境 |
POST |
http://www.naipan.com/open/weiyuanchuang/towei.html |
API请求结构
参数 |
类型 |
描述 |
示例值 |
regname |
String |
购买的授权用户 |
test@163.com |
regsn |
String |
购买的授权码 |
ICQl3kdebh7zns97XVT9dLDBASR7pBrM2AAKbI7HpMw= |
content |
String |
需要伪原创的文章内容 |
新版奶盘SEO伪原创采用独有的分词引擎以及自创同义词库,模拟百度等中文切词进行伪原创,生成后的伪原创文章更准确更贴近百度等搜索引擎收录。 |
API返回结构
参数 |
类型 |
描述 |
示例值 |
result |
int |
返回状态 |
1 成功 -1 失败 |
message |
String |
返回错误信息 |
状态为-1时,错误原因显示 |
content |
String |
伪原创后的文章内容 |
错误时返回原文 |
【UTF-8编码】PHP整合代码
$url = 'http://www.naipan.com/open/weiyuanchuang/towei.html';
$content='您的文章内容';
$data = array(
'regname'=>'test@163.com',
'regsn'=>'ICQl3kdebh7zns97XVT9dLDBASR7pBrM2AAKbI7HpMw=',
'content'=>$content
);
$ch = curl_init();
$timeout = 5000;
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$handles = curl_exec($ch);
curl_close($ch);
$json_data = $handles;
$array = json_decode($json_data,true);
if($array['result']==1){
$content=$array['content'];
}
echo $content;//伪原创后的文章内容
【GBK编码】PHP整合代码
$url = 'http://www.naipan.com/open/weiyuanchuang/towei.html';
$content='您的文章内容';
$content= iconv('gbk','utf-8',$content);
$data = array(
'regname'=>'test@163.com',
'regsn'=>'ICQl3kdebh7zns97XVT9dLDBASR7pBrM2AAKbI7HpMw=',
'content'=>$content
);
$ch = curl_init();
$timeout = 5000;
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$handles = curl_exec($ch);
curl_close($ch);
$json_data = $handles;
$array = json_decode($json_data,true);
if($array['result']==1){
$content=$array['content'];
$content= iconv('utf-8','gbk',$content);
}
echo $content;//伪原创后的文章内容
python整合代码
import requests
import json
url="http://www.naipan.com/open/weiyuanchuang/towei.html"
content='您的文章内容'
data={
"regname":"test@163.com",
'regsn':"ICQl3kdebh7zns97XVT9dLDBASR7pBrM2AAKbI7HpMw=",
'content':content
}
res=requests.post(url,data=data)
jsonh=json.loads(res.text)
print(jsonh["content"])//伪原创后的文章内容
JAVA整合代码
public static void main(String[] args) {
String url = "http://www.naipan.com/open/weiyuanchuang/towei.html";// 奶盘请求接口地址
Map params = new HashMap();// 请求参数
params.put("regname", "test@163.com");// 授权用户
params.put("regsn", "ICQl3kdebh7zns97XVT9dLDBASR7pBrM2AAKbI7HpMw=");// 授权码
params.put("content", "文章内容");// 文章内容
String returnContent = "";
try {
returnContent = net(url, params, "POST");
System.out.println(returnContent);// 返回json格式,如{"content":"文章内容","message":"伪原创成功!","result":1}
} catch (Exception e) {
e.printStackTrace();
}
}
/**
*
* @param strUrl 请求地址
* @param params 请求参数
* @param method 请求方法
* @return 网络请求字符串
* @throws Exception
*/
public static String net(String strUrl, Map params, String method)
throws Exception {
final String DEF_CHATSET = "UTF-8";
final int DEF_CONN_TIMEOUT = 30000;
final int DEF_READ_TIMEOUT = 30000;
String userAgent = "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.66 Safari/537.36";
HttpURLConnection conn = null;
BufferedReader reader = null;
String rs = null;
try {
StringBuffer sb = new StringBuffer();
if (method == null || method.equals("GET")) {
strUrl = strUrl + "?" + urlencode(params);
}
URL url = new URL(strUrl);
conn = (HttpURLConnection) url.openConnection();
if (method == null || method.equals("GET")) {
conn.setRequestMethod("GET");
} else {
conn.setRequestMethod("POST");
conn.setDoOutput(true);
}
conn.setRequestProperty("User-agent", userAgent);
conn.setUseCaches(false);
conn.setConnectTimeout(DEF_CONN_TIMEOUT);
conn.setReadTimeout(DEF_READ_TIMEOUT);
conn.setInstanceFollowRedirects(false);
conn.connect();
if (params != null && method.equals("POST")) {
try {
DataOutputStream out = new DataOutputStream(
conn.getOutputStream());
out.writeBytes(urlencode(params));
} catch (Exception e) {
e.printStackTrace();
}
}
InputStream is = conn.getInputStream();
reader = new BufferedReader(new InputStreamReader(is, DEF_CHATSET));
String strRead = null;
while ((strRead = reader.readLine()) != null) {
sb.append(strRead);
}
rs = sb.toString();
} catch (IOException e) {
e.printStackTrace();
} finally {
if (reader != null) {
reader.close();
}
if (conn != null) {
conn.disconnect();
}
}
return rs;
}
// 将map型转为请求参数型
public static String urlencode(Map data) {
StringBuilder sb = new StringBuilder();
for (Map.Entry i : data.entrySet()) {
try {
sb.append(i.getKey()).append("=")
.append(URLEncoder.encode(i.getValue() + "", "UTF-8"))
.append("&");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
}
return sb.toString();
}