Ich möchte einen Online Treasurecreator machen allerdings weiß ich nicht wie ich eine Treasure erstelle alle meine Versuche sind fehlgeschlagen. Weiß jemand wie man das macht?
Der Ansatz klingt richtig. Eine API bietet Elitepvpers allerdings nicht an, es gibt nur eine zum Auslesen der elite*gold Transaktionen.Quote:
Ich weiß nicht wie es geht, allerdings solltest du es so herausfinden können:
Geh auf die Seite, auf der die Treasure erstellt wird und fülle das entsprechende Formular aus. Drücke dann auf Submit. Dann solltest du dir ein AddOn oder generell die Möglichkeit besorgen, POST-Werte mitzulesen.
Dann kannst du sehen, welche Werte übergeben werden und dann selber mit PHP einen Link erstellen, der ebenfalls per POST die entsprechenden Werte übergibt.
Das wäre meine herangehensweise. Vllt. bietet e*pvp aber auch eine Schnittstelle für so etwas an? Das weiß ich allerdings nicht.
public function cURL($sURL, $aData = array()) {
$oCURL = curl_init();
curl_setopt($oCURL, CURLOPT_COOKIEJAR, dirname(__FILE__) . '/elitepvpers.cookies.txt');
curl_setopt($oCURL, CURLOPT_COOKIEFILE, dirname(__FILE__) . '/elitepvpers.cookies.txt');
curl_setopt($oCURL, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($oCURL, CURLOPT_HEADER, 0);
curl_setopt($oCURL, CURLOPT_RETURNTRANSFER, true);
curl_setopt($oCURL, CURLOPT_TIMEOUT, 30);
curl_setopt($oCURL, CURLOPT_URL, $sURL);
curl_setopt($oCURL, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.3; WOW64; rv:30.0) Gecko/20100101 Firefox/30.0');
if (count($aData) > 0) {
curl_setopt($oCURL, CURLOPT_POST, 1);
curl_setopt($oCURL, CURLOPT_POSTFIELDS, $aData);
}
$sResponse = curl_exec($oCURL);
if (strpos($sResponse, 'SECURITYTOKEN')) {
$this->securitytoken = explode('";', explode('SECURITYTOKEN = "', $sResponse)[1])[0];
}
curl_close($oCURL);
return $sResponse;
}
Danke, genau das hab ich auch gesucht! ;)Quote:
Ausschnitt aus meiner elitepvpers Klasse, Treasure URL übergeben und ein Array mit den Post Parametern, fertig.PHP Code:public function cURL($sURL, $aData = array()) {
$oCURL = curl_init();
curl_setopt($oCURL, CURLOPT_COOKIEJAR, dirname(__FILE__) . '/elitepvpers.cookies.txt');
curl_setopt($oCURL, CURLOPT_COOKIEFILE, dirname(__FILE__) . '/elitepvpers.cookies.txt');
curl_setopt($oCURL, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($oCURL, CURLOPT_HEADER, 0);
curl_setopt($oCURL, CURLOPT_RETURNTRANSFER, true);
curl_setopt($oCURL, CURLOPT_TIMEOUT, 30);
curl_setopt($oCURL, CURLOPT_URL, $sURL);
curl_setopt($oCURL, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.3; WOW64; rv:30.0) Gecko/20100101 Firefox/30.0');
if (count($aData) > 0) {
curl_setopt($oCURL, CURLOPT_POST, 1);
curl_setopt($oCURL, CURLOPT_POSTFIELDS, $aData);
}
$sResponse = curl_exec($oCURL);
if (strpos($sResponse, 'SECURITYTOKEN')) {
$this->securitytoken = explode('";', explode('SECURITYTOKEN = "', $sResponse)[1])[0];
}
curl_close($oCURL);
return $sResponse;
}