Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

paginad

Web Service em ASP

Recommended Posts

Tenho um código aqui feito em PHP e gostaria de saber como faço essa mesma coisa em ASP. Preciso acessar um web service de integração para o Painel Plesk.

 

<?php

define("HOST", "");
define("PORT", 8443);
define("PATH", "enterprise/control/agent.php");
define("LOGIN", "");
define("PASSWD", "");
define("PROTO_VER", "1.4.2.0");

$proto = PROTO_VER;
$data =<<<EOF
<?xml version="1.0" encoding="UTF-8" ?>
<packet version="1.4.2.0">
<domain>
<set>   
	<filter>	
        <domain_name>teste2.com.br</domain_name>
	</filter>
	<values>
	<gen_setup>	
	<status>64</status>   
	</gen_setup>
	</values>
</set>
</domain>
</packet>
EOF;

function write_callback($ch, $data)
{
echo $data;
return strlen($data);
}

function sendCommand()
{
$url = "https://" . HOST . ":" . PORT . "/" . PATH;

$headers = array(
"HTTP_AUTH_LOGIN: " . LOGIN,
"HTTP_AUTH_PASSWD: " . PASSWD,
"HTTP_PRETTY_PRINT: TRUE",
"Content-Type: text/xml",
);

// Initalize the curl engine
$ch = curl_init();

// Set the curl options
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
// this line makes it work under https
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_HTTPHEADER, &$headers);

// Set the URL to be processed
curl_setopt($ch, CURLOPT_URL, $url);

// Set the callback functions
curl_setopt($ch, CURLOPT_WRITEFUNCTION, write_callback);

// Set the data to be send
global $data;
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);

// Debug, however...
curl_setopt($ch, CURLOPT_VERBOSE, 1);

$result = curl_exec($ch);

if ($result == CURL_OK) {
//print_r(curl_getinfo($ch));
} else {
echo "\n\n-------------------------\n" .
"cURL error number:" .
curl_errno($ch);
echo "\n\ncURL error:" . curl_error($ch);
}

curl_close($ch);

return;
}

sendCommand();

?>

Compartilhar este post


Link para o post
Compartilhar em outros sites

lembrando k você pode ter um code, sistema para fazer isso tb, existem alguns outros codigos k fazem esse

gerenciamento tipo explorer...

 

olha este linktalvez ajude em algo...

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.