opiniones
Level
0Following
0
Score
104Follower
0
Point
104
-
opiniones
-
My topic
Login problem
-
Hello,
I have a problem API.
If I use it directly in a php I have a login error but if I use it from a html form that makes a post call to that php works fine.
Any ideas?
function getSpinResult($articulo,$idioma){
$apikey=my api id;
$username=my user;
$pass=my pass;
$spin_type="1";
//Get article from request
$article = $articulo;
//Set parameters default value
if(empty($_REQUEST["orderly"])){
$_REQUEST["orderly"] = 0;
}
if(empty($_REQUEST["UseGrammarAI"])){
$_REQUEST["UseGrammarAI"] = 0;
}
if(empty($_REQUEST["pos"])){
$_REQUEST["pos"] = 0;
}
if(empty($_REQUEST["protecthtml"])){
$_REQUEST["protecthtml"] = 0;
}
if(empty($_REQUEST["spintype"])){
$_REQUEST["spintype"] = 1;
}
if(empty($_REQUEST["not_use_oglword"])){
$_REQUEST["not_use_oglword"] = 0;
}
if(empty($_REQUEST["usehurricane"])){
$_REQUEST["usehurricane"] = 0;
}
if(empty($_REQUEST["chartype"])){
$_REQUEST["chartype"] = 1;
}
if(empty($_REQUEST["convertbase"])){
$_REQUEST["convertbase"] = 0;
}
if(empty($_REQUEST["onecharforword"])){
$_REQUEST["onecharforword"] = 0;
}
if(empty($_REQUEST["percent"])){
$_REQUEST["percent"] = 0;
}
if(empty($_REQUEST["spinhtml"])){
$_REQUEST["spinhtml"] = 0;
}
if(empty($_REQUEST["protecthtml"])){
$_REQUEST["protecthtml"] = "null";
}
if(empty($_REQUEST["protectwords"])){
$_REQUEST["protectwords"] = "null";
}
if(empty($_REQUEST["tagprotect"])){
$_REQUEST["tagprotect"] = "null";
}
if(empty($_REQUEST["rule"])){
$_REQUEST["rule"] = 0;
}
if(empty($_REQUEST["wordquality"])){
$_REQUEST["wordquality"] = 0;
}
if(empty($_REQUEST["thesaurus"])){
$_REQUEST["thesaurus"] = "Italian";
}else{
$_REQUEST["thesaurus"] = "Italian";
}
//$idioma="Italian";
//Get IP address and Port
$address="api.spinnerchief.com:443";
$arr = spilt($address, ':');
$ip = $arr[0];
$port = $arr[1];
if(empty($port))
$port = 443;
//Write whole Url
$url = "/spintype=".$_REQUEST["spintype"]."&spinfreq="
.$_REQUEST["spinfreq"]."&autospin=".$_REQUEST["autospin"]."&original=".$_REQUEST["not_use_oglword"].
"&wordscount=".$_REQUEST["wordscount"]."&usehurricane=".$_REQUEST["usehurricane"]."&chartype="
.$_REQUEST["chartype"]."&convertbase=".$_REQUEST["convertbase"]."&onecharforword=".$_REQUEST["onecharforword"].
"&percent=".$_REQUEST["percent"]."&protecthtml=".$_REQUEST["protecthtml"]."&spinhtml="
.$_REQUEST["spinhtml"]."&orderly=".$_REQUEST["orderly"]."&wordquality="
.$_REQUEST["wordquality"]."&username=".$username."&password=".$pass.
"&apikey="
.$apikey."&protectwords=".$_REQUEST["protectwords"]."&querytimes="
.$_REQUEST["querytimes"]."&replacetype=".$_REQUEST["replacetype"]."&pos=".$_REQUEST["pos"].
"&UseGrammarAI=".$_REQUEST["UseGrammarAI"]."&rule=".$_REQUEST["rule"]."&thesaurus="
.$idioma."&phrasecount=".$_REQUEST["phrasecount"]."&tagprotect="
.$_REQUEST["tagprotect"];
//Send request and return result
//echo "http://".$ip.":".$port.$url, $article."</br></br></br></br>";
return curl_request("http://".$ip.":".$port.$url, $article);
}
function curl_request($url, $data){
$req = curl_init();
curl_setopt($req, CURLOPT_URL, $url);
curl_setopt($req, CURLOPT_RETURNTRANSFER,1);
curl_setopt($req, CURLOPT_POST, true);
curl_setopt($req, CURLOPT_POSTFIELDS, $data);
$result = trim(curl_exec($req));
curl_close($req);
return $result;
}
-
2017-01-31 09:05
-
Loading.
Done.