Példa Kód (PHP) / Example Code (PHP)

<?php
function DataDecode($data){
	$key_phaze="@#";
	$cleardata=str_replace($key_phaze,'',strstr($data, $key_phaze));
	$arr=(array)json_decode($cleardata, true);
	unset($data,$cleardata,$key_phaze);
	return $arr;
}
function PostToEzit($pdata)
{
	$postURL='https://client.ezit.hu/reseller/controller.php';
	
	//Állandó paraméterek
	$pdata["Username"]='viszonteladoi@fiok.hu';
	$pdata["Password"]=base64_encode('t1tK0Sjelsz0');
	$pdata["valid_domain"]=str_replace("www.","",$_SERVER['SERVER_NAME']);
	$pdata["valid_ip"]=$_SERVER['SERVER_ADDR'];
	$pdata["SecretKey"]='ezit-55de77e925b3a708224982c9e5080cef';

	//Eseti parancs paraméterei
	$pdata["api_action"]='dailyupdate';
	$pdata["sld"]='teszt-domain-123';
	$pdata["tld"]='hu';
	
	$fields_string = http_build_query($pdata);
	
	$keyHeader=strrev(md5($pdata["valid_domain"].$pdata["Username"]));
	$ch = curl_init();    
	curl_setopt($ch, CURLOPT_URL, $postURL); 
	curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/x-www-form-urlencoded; charset=UTF-8",'Domainseller:'.$keyHeader));
	curl_setopt($ch, CURLOPT_HEADER, 0);
	curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
	curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
	curl_setopt($ch, CURLOPT_TIMEOUT, 60);
	curl_setopt($ch, CURLOPT_POST, 1);
	curl_setopt($ch, CURLOPT_POSTFIELDS,$fields_string); 
	curl_setopt($ch, CURLOPT_FRESH_CONNECT, 1);
	$data = curl_exec($ch);
	$info = curl_getinfo($ch);
	$error= curl_errno($ch);
	curl_close($ch);
	$decoded_data=DataDecode($data);
	
	return $decoded_data;
}
Hasznosnak találta ezt a választ? 47 A felhasználók hasznosnak találták ezt (53 Szavazat)