Foros del Web » Programando para Internet » PHP »

PHP XML web service

Estas en el tema de PHP XML web service en el foro de PHP en Foros del Web. tengo una pagina que me conecta a el web service de busqueda de google, necesito presentar el resultado en pantalla, hasta ahora el resultado que ...
  #1 (permalink)  
Antiguo 20/05/2005, 12:40
 
Fecha de Ingreso: marzo-2005
Mensajes: 90
Antigüedad: 12 años, 9 meses
Puntos: 0
PHP XML web service

tengo una pagina que me conecta a el web service de busqueda de google, necesito presentar el resultado en pantalla, hasta ahora el resultado que me da es un xml, aqui les adjunto el codigo:
<?php
/*
* $Id: client3.php,v 1.2 2004/01/26 07:15:20 snichol Exp $
*
* Client sample.
*
* Service: SOAP endpoint
* Payload: rpc/encoded
* Transport: http
* Authentication: none
*/

require_once('nusoap/lib/class.nusoap_base.php');
//consulta
$query = isset($_POST['query']) ? $_POST['query'] : '';
//cantidad de resultados
//$cantidad = isset($_POST['cantidad']) ? $_POST['cantidad'] : '';

$proxyhost = isset($_POST['proxyhost']) ? $_POST['proxyhost'] : '';
$proxyport = isset($_POST['proxyport']) ? $_POST['proxyport'] : '';
$proxyusername = isset($_POST['proxyusername']) ? $_POST['proxyusername'] : '';
$proxypassword = isset($_POST['proxypassword']) ? $_POST['proxypassword'] : '';
$client = new soapclient("http://api.google.com/search/beta2", false,
$proxyhost, $proxyport, $proxyusername, $proxypassword);
$err = $client->getError();
if ($err) {
echo '<h2>Constructor error</h2><pre>' . $err . '</pre>';
}
$client->soap_defencoding = 'UTF-8';

//echo 'You must set your own Google key in the source code to run this client!';
//exit();
$params = array(
'Googlekey'=>'zY0wcdhQFHKJUcJ/+YH10bszqWKm4Q9A',
'queryStr'=>$query,
'startFrom'=>0,
'maxResults'=>10,
'filter'=>true,
'restrict'=>'',
'adultContent'=>true,
'language'=>'',
'iencoding'=>'',
'oendcoding'=>''
);
$result = $client->call("doGoogleSearch", $params, "urn:GoogleSearch", "urn:GoogleSearch");
if ($client->fault) {
echo '<h2>Fault</h2><pre>'; print_r($result); echo '</pre>';
} else {
$err = $client->getError();
if ($err) {
echo '<h2>Error</h2><pre>' . $err . '</pre>';
} else {
echo '<h2>Result</h2><pre>'; print_r($result); echo '</pre>';
}
}
echo '<h2>Request</h2><pre>' . htmlspecialchars($client->request, ENT_QUOTES) . '</pre>';
echo '<h2>Response</h2><pre>' . htmlspecialchars($client->response, ENT_QUOTES) . '</pre>';
echo '<h2>Debug</h2><pre>' . htmlspecialchars($client->debug_str, ENT_QUOTES) . '</pre>';
?>
  #2 (permalink)  
Antiguo 20/05/2005, 12:45
 
Fecha de Ingreso: marzo-2005
Mensajes: 90
Antigüedad: 12 años, 9 meses
Puntos: 0
adjunto el xml de respuesta

Array
(
[directoryCategories] =>

[documentFiltering] =>
[endIndex] => 10
[estimateIsExact] =>
[estimatedTotalResultsCount] => 28400000
[resultElements] => Array
(
[0] => Array
(
[URL] => http://www.adobe.com/products/acrobat/readstep2.html
[cachedSize] => 77k
[directoryCategory] => Array
(
[fullViewableName] =>
[specialEncoding] =>
)

[directoryTitle] =>
[hostName] =>
[relatedInformationPresent] => 1
[snippet] => ... Thank you for your interest in Adobe® Reader® 7.0 ? free software that lets
... print, search, and share Adobe Portable Document Format (PDF) files more ...
[summary] =>
[title] => Adobe Reader - Download
)

[1] => Array
(
[URL] => http://www.adobe.com/
[cachedSize] => 28k
[directoryCategory] => Array
(
[fullViewableName] => Top/Computers/Software/Graphics/Companies
[specialEncoding] =>
)

[directoryTitle] => Adobe Systems Incorporated
[hostName] =>
[relatedInformationPresent] => 1
[snippet] => Developers of software solutions for graphic designers and professional publishers,
products include Illustrator, Photoshop, Premiere, After Effects, ...
[summary] => Developers of software solutions for graphic designers and professional publishers,
products include Illustrator, Photoshop, Premiere, After Effects, ...
[title] => Adobe Systems Incorporated
)

[2] => Array
(
[URL] => http://www.adobe.com/products/acrobat/main.html
[cachedSize] => 34k
[directoryCategory] => Array
(
[fullViewableName] => Top/Computers/Software/Word_Processors/PDF
[specialEncoding] =>
)

[directoryTitle] => Adobe ePaper Products
[hostName] =>
[relatedInformationPresent] => 1
[snippet] => Adobe's product guide for their ePaper solutions, including Acrobat product guide,
technologies, third-party plugins, Acrobat Reader for Palm OS, ...
[summary] => Adobe's product guide for their ePaper solutions, including Acrobat product guide,
technologies, third-party plugins, Acrobat Reader for Palm OS, ...
[title] => Adobe Acrobat Family
)

[3] => Array
(
[URL] => http://www.adobe.com/products/acrobat/readermain.html
[cachedSize] => 26k
[directoryCategory] => Array
(
[fullViewableName] => Top/Computers/E-Books/Readers/Software/Adobe
[specialEncoding] =>
)

[directoryTitle] => Adobe Acrobat eBook Reader
[hostName] =>
[relatedInformationPresent] => 1
[snippet] => ... Enhance information exchange using Adobe PDF files. Adobe® Reader® is free
software that allows everyone from business professionals to home users to ...
[summary] => Download, product information, and support.
[title] => Adobe Reader
)

[4] => Array
(
[URL] => http://www.adobe.com/products/photoshop/main.html
[cachedSize] => 39k
[directoryCategory] => Array
(
[fullViewableName] =>
[specialEncoding] =>
)

[directoryTitle] =>
[hostName] =>
[relatedInformationPresent] => 1
[snippet] => ... onsider the Adobe Creative Suite for a complete workflow solution. Adobe Photoshop.
order. Take your ideas further with Adobe Creative Suite 2 Premium ...
[summary] =>
[title] => Professional photo editing software - the digital imaging software ...
)

[5] => Array
(
[URL] => http://www.adobe.com/support/downloads/main.html
[cachedSize] => 81k
[directoryCategory] => Array
(
[fullViewableName] =>
[specialEncoding] =>
)

[directoryTitle] =>
[hostName] =>
[relatedInformationPresent] => 1
[snippet] => ... Find updates, plug-ins, filters, and other files for your Adobe products. ...
By downloading software from the Adobe Web site you agree to the terms of ...
[summary] =>
[title] => Downloads - Adobe CustomerFirst Support
)

[6] => Array
(
[URL] => http://www.adobe.com/products/acrobat/alternate.html
[cachedSize] => 40k
[directoryCategory] => Array
(
[fullViewableName] =>
[specialEncoding] =>
)

[directoryTitle] =>
[hostName] =>
[relatedInformationPresent] => 1
[snippet] => Update Advisory: Adobe Systems encourages you to update to the latest release
... Below are quick links to the latest versions of Adobe® Reader® software. ...
[summary] =>
[title] => Adobe Reader Download Page
)

[7] => Array
(
[URL] => http://www.adobe.com/products/premiere/main.html
[cachedSize] => 50k
[directoryCategory] => Array
(
[fullViewableName] =>
[specialEncoding] =>
)

[directoryTitle] =>
[hostName] =>
[relatedInformationPresent] => 1
[snippet] => ... Adobe® Premiere® Pro 1.5 software revolutionizes nonlinear video editing. ...
Adobe Premiere Pro 1.5 takes video production to an entirely new level. ...
[summary] =>
[title] => Digital video: Adobe Premiere Pro
)

[8] => Array
(
[URL] => http://www.adobe.com/products/golive/main.html
[cachedSize] => 34k
[directoryCategory] => Array
(
[fullViewableName] =>
[specialEncoding] =>
)

[directoryTitle] =>
[hostName] =>
[relatedInformationPresent] => 1
[snippet] => ... Adobe® GoLive® CS2 software lets you unlock the power of CSS with ... Jump-start
your designs by easily converting Adobe InDesign® layouts into Web ...
[summary] =>
[title] => Adobe GoLive
)

[9] => Array
(
[URL] => http://www.adobe.com/svg/
[cachedSize] => 61k
[directoryCategory] => Array
(
[fullViewableName] => Top/Computers/Data_Formats/Graphics/Vector/SVG
[specialEncoding] =>
)

[directoryTitle] => Future of Web Graphics in SVG
[hostName] =>
[relatedInformationPresent] => 1
[snippet] => Adobe's description of the benefits of SVG and their plans for it.
[summary] => Adobe's description of the benefits of SVG and their plans for it.
[title] => Adobe SVG Zone
)

)

[searchComments] =>
[searchQuery] => adobe
[searchTime] => 0.042684
[searchTips] =>
[startIndex] => 1
)
  #3 (permalink)  
Antiguo 20/05/2005, 18:39
Avatar de sism82  
Fecha de Ingreso: octubre-2003
Ubicación: Guadalajara
Mensajes: 865
Antigüedad: 14 años, 1 mes
Puntos: 1
si ya lo tienes en arreglo, simplemente itera sobre los elementos, no entiendo del todo tu pregunta, podrias ser mas explícito?
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 00:25.