- Postagens: 3
- Obrigados Recebidos: 0
[RESOLVIDO] Ajuda com webservice XML-RPC.
- Rudy
-
Autor do Tópico
- Offline
- JCB! Novato
-
Menos
Mais
13 anos 9 meses atrás #61900
por Rudy
Rudy created the topic: [RESOLVIDO] Ajuda com webservice XML-RPC.
Aloha pessoas!!!
Estou tentando consumir webservice do joomla, mas deparei-me com um erro que não consigo solucionar.
Antes de mais nada, quero dizer que, já habilitei o webservice nas configurações globais e já habilitei o plugin.
Estou tentando consumir o serviço searchSite, mas não estou conseguindo. Abaixo esta meu cliente:
Quando executo ele, tenho o seguinte resultado do var_dump():
if
object(xmlrpcresp)[5]
public 'val' => int 0
public 'valtyp' => null
public 'errno' => int 5
public 'errstr' => string 'Connect error: php_network_getaddresses: getaddrinfo failed: Name or service not known (0)' (length=90)
public 'payload' => null
public 'hdrs' =>
array
empty
public '_cookies' =>
array
empty
public 'content_type' => string 'text/xml' (length=
public 'raw_data' => string '' (length=0)
Alguém pode ajudar-me com isso?
Obrigado.
Estou tentando consumir webservice do joomla, mas deparei-me com um erro que não consigo solucionar.
Antes de mais nada, quero dizer que, já habilitei o webservice nas configurações globais e já habilitei o plugin.
Estou tentando consumir o serviço searchSite, mas não estou conseguindo. Abaixo esta meu cliente:
<?php
require_once("phpxmlrpc/xmlrpc.php");
/**
* Searches a remote site.
* @param string $p1
* @param string $p2
* @param int $debug when 1 (or 2) will enable debugging of the underlying xmlrpc call (defaults to 0)
* @return string (or an xmlrpcresp obj instance if call fails)
*/
function xmlrpc_joomla_searchSite ($p1, $p2, $debug=2) {
$client =& new xmlrpc_client('/xmlrpc/index.php', '192.168.0.001/joomla', 0);
$client->return_type = 'xmlrpcvals';
$client->setDebug($debug);
$msg =& new xmlrpcmsg('joomla.searchSite');
$p1 =& new xmlrpcval($p1, 'string');
$msg->addparam($p1);
$p2 =& new xmlrpcval($p2, 'string');
$msg->addparam($p2);
$res =& $client->send($msg, 0, '');
if($res->faultcode()){
echo "if";
return $res;
}
else{
echo "else";
return php_xmlrpc_decode($res->value());
}
}
var_dump(xmlrpc_joomla_searchSite('teste1','ALL'));
?>
Quando executo ele, tenho o seguinte resultado do var_dump():
if
object(xmlrpcresp)[5]
public 'val' => int 0
public 'valtyp' => null
public 'errno' => int 5
public 'errstr' => string 'Connect error: php_network_getaddresses: getaddrinfo failed: Name or service not known (0)' (length=90)
public 'payload' => null
public 'hdrs' =>
array
empty
public '_cookies' =>
array
empty
public 'content_type' => string 'text/xml' (length=

public 'raw_data' => string '' (length=0)
Alguém pode ajudar-me com isso?
Obrigado.
Please Entrar ou Registrar to join the conversation.
- Rudy
-
Autor do Tópico
- Offline
- JCB! Novato
-
Menos
Mais
- Postagens: 3
- Obrigados Recebidos: 0
13 anos 9 meses atrás #61908
por Rudy
Quando eu coloco http:// na url, o erro muda:
object(xmlrpcresp)[5]
public 'val' => int 0
public 'valtyp' => null
public 'errno' => int 5
public 'errstr' => string 'Connect error: Unable to find the socket transport "http" - did you forget to enable it when you configured PHP? (32608)' (length=120)
public 'payload' => null
public 'hdrs' =>
array
empty
public '_cookies' =>
array
empty
public 'content_type' => string 'text/xml' (length=
public 'raw_data' => string '' (length=0)
Rudy replied the topic: Re: Ajuda com webservice XML-RPC.
Rudy escreveu: Aloha pessoas!!!
Estou tentando consumir webservice do joomla, mas deparei-me com um erro que não consigo solucionar.
Antes de mais nada, quero dizer que, já habilitei o webservice nas configurações globais e já habilitei o plugin.
Estou tentando consumir o serviço searchSite, mas não estou conseguindo. Abaixo esta meu cliente:<?php require_once("phpxmlrpc/xmlrpc.php"); /** * Searches a remote site. * @param string $p1 * @param string $p2 * @param int $debug when 1 (or 2) will enable debugging of the underlying xmlrpc call (defaults to 0) * @return string (or an xmlrpcresp obj instance if call fails) */ function xmlrpc_joomla_searchSite ($p1, $p2, $debug=2) { $client =& new xmlrpc_client('/xmlrpc/index.php', '192.168.0.001/joomla', 0); $client->return_type = 'xmlrpcvals'; $client->setDebug($debug); $msg =& new xmlrpcmsg('joomla.searchSite'); $p1 =& new xmlrpcval($p1, 'string'); $msg->addparam($p1); $p2 =& new xmlrpcval($p2, 'string'); $msg->addparam($p2); $res =& $client->send($msg, 0, ''); if($res->faultcode()){ echo "if"; return $res; } else{ echo "else"; return php_xmlrpc_decode($res->value()); } } var_dump(xmlrpc_joomla_searchSite('teste1','ALL')); ?>
Quando executo ele, tenho o seguinte resultado do var_dump():
if
object(xmlrpcresp)[5]
public 'val' => int 0
public 'valtyp' => null
public 'errno' => int 5
public 'errstr' => string 'Connect error: php_network_getaddresses: getaddrinfo failed: Name or service not known (0)' (length=90)
public 'payload' => null
public 'hdrs' =>
array
empty
public '_cookies' =>
array
empty
public 'content_type' => string 'text/xml' (length=
public 'raw_data' => string '' (length=0)
Alguém pode ajudar-me com isso?
Obrigado.
Quando eu coloco http:// na url, o erro muda:
object(xmlrpcresp)[5]
public 'val' => int 0
public 'valtyp' => null
public 'errno' => int 5
public 'errstr' => string 'Connect error: Unable to find the socket transport "http" - did you forget to enable it when you configured PHP? (32608)' (length=120)
public 'payload' => null
public 'hdrs' =>
array
empty
public '_cookies' =>
array
empty
public 'content_type' => string 'text/xml' (length=

public 'raw_data' => string '' (length=0)
Please Entrar ou Registrar to join the conversation.
- Rudy
-
Autor do Tópico
- Offline
- JCB! Novato
-
Menos
Mais
- Postagens: 3
- Obrigados Recebidos: 0
13 anos 9 meses atrás #61941
por Rudy
Rudy replied the topic: Re: Ajuda com webservice XML-RPC.
Consegui resolver, para quem precisar, segue abaixo o código ajustado:
<?php
require_once("phpxmlrpc/xmlrpc.php");
/**
* Searches a remote site.
* @param string $p1
* @param string $p2
* @param int $debug when 1 (or 2) will enable debugging of the underlying xmlrpc call (defaults to 0)
* @return string (or an xmlrpcresp obj instance if call fails)
*/
function xmlrpc_joomla_searchSite ($p1, $p2, $debug=2) {
$client =& new xmlrpc_client('/joomla/xmlrpc/index.php', '192.168.0.001', 0);
$client->return_type = 'xmlrpcvals';
$client->setDebug($debug);
$msg =& new xmlrpcmsg('joomla.searchSite');
$p1 =& new xmlrpcval($p1, 'string');
$msg->addparam($p1);
$p2 =& new xmlrpcval($p2, 'string');
$msg->addparam($p2);
$res =& $client->send($msg, 0, '');
if($res->faultcode()){
echo "if";
return $res;
}
else{
echo "else";
return php_xmlrpc_decode($res->value());
}
}
var_dump(xmlrpc_joomla_searchSite('teste1','ALL'));
?>
Please Entrar ou Registrar to join the conversation.
- rolexsanches
-
- Offline
- JCB! Novato
-
Menos
Mais
- Postagens: 1
- Obrigados Recebidos: 0
11 anos 8 meses atrás #95479
por rolexsanches
rolexsanches replied the topic: Re: [RESOLVIDO] Ajuda com webservice XML-RPC.
Parabéns cara!
Me ajudou demais com essa solução.
Às vezes alguns parâmetros escondidos das funções do PHP nos atrapalham muito.
Me ajudou demais com essa solução.
Às vezes alguns parâmetros escondidos das funções do PHP nos atrapalham muito.
Please Entrar ou Registrar to join the conversation.