BizTalk Utilities CV ,   Jobs ,   Code library  
 
Home Page
PHP XML
PHP XML RPC Function EncodeRequest
PHP XML RPC Function Encode
PHP XML RPC Function DecodeRequest
PHP DOMXPath Function registerNamespace
PHP DOMXPath Function query
PHP DOMText Function splitText
PHP DOMText Function isWhitespaceInElementContent
PHP DOMNode Function replaceChild
PHP DOMNode Function lookupPrefix
PHP DOMNode Function lookupNamespaceURI
PHP DOMNode Function isSupported
PHP DOMNode Function isSameNode
PHP DOMNode Function insertBefore
PHP DOMNode Function hasChildNodes
PHP DOMNode Function hasAttributes
PHP DOMNode Function cloneNode
PHP DOMNodelist Function item
PHP DOMNamedNodeMap Function item
PHP DOMNamedNodeMap Function getNamedItemNS
PHP DOMNamedNodeMap Function getNamedItem
 
 

By :Mark Wilson
I am the creator of TopXML. I am available for international and local (Australia) contracts. I am a Solution Architect/Business Analyst. I have worked in IT in several countries (NZ, Australia, South Africa, UK) building and training teams for government and very large non-governmental organizations. I am ex-Microsoft Consulting Services. I wrote the first book on Microsoft XML published in 2000 called XML Programming with VB and ASP. Most recently I have been building tools for the SEO industry. Ask me for a 37 point SEO health-checkup for your website.
First posted :03/24/2008
Times viewed :215

 

PHP XML RPC Function GetType

PHP Version: (PHP 4 >= 4.1.0, PHP 5)

Description

This function returns the xmlrpc type for php value.

Usage:

string xmlrpc_get_type ( mixed value)

This function returns the xmlrpc type of the PHP value. Please look into http://www.xmlrpc.com/spec for more details on xmlrpc specifications. In my example I have sent a structure as a response and return value is also a structure.

PHP Code for as a client:

<?php

function do_call($host, $port, $request) {

$fp = fsockopen($host, $port, $errno, $errstr);

$query = "POST /default/php/server.php HTTP/1.0\nUser_Agent: This is a Dummy Client\nHost: ".$host."\nContent-Type: text/xml\nContent-Length: ".strlen($request)."\n\n".$request."\n";

if (!fputs($fp, $query, strlen($query))) {

$errstr = "Write error";

return 0;

}

$contents = '';

while (!feof($fp)) {

$contents .=fgets($fp);

}

fclose($fp);

return $contents;

}

$host = 'localhost';

$port = 80;

$obj->type="datetime";

$obj->scalar="20040420T13:32:40";

$obj->timestamp=1082460760;

$request = xmlrpc_encode_request('dummyserver', $obj);

$response = do_call($host, $port, $request);

//Get the xmlrpc type

$xmlrpctype = xmlrpc_get_type($response);

//print the xml rpc type

print_r( $xmlrpctype);

?>

Response:

HTTP/1.1 200 OK
Date: Sat, 15 Jan 2005 16:41:17 GMT
Server: Apache/2.0.52 (Win32) PHP/5.0.3
X-Powered-By: PHP/5.0.3
Content-Length: 637
Connection: close
Content-Type: text/xml
<?xml version="1.0" encoding="iso-8859-1"?>
<methodResponse>
<params>
 <param>
  <value>
  <array>
   <data>
   <value>
   <struct>
     <member>
     <name>type</name>
     <value>
     <string>datetime</string>
     </value>
     </member>
     <member>
     <name>scalar</name>
     <value>
     <string>20040420T13:32:40</string>
     </value>
     </member>
     <member>
     <name>timestamp</name>
     <value>
     <int>1082460760</int>
     </value>
     </member>
   </struct>
   </value>
   </data>
   </array>
   </value>
   </param>
</params>
</methodResponse>

Output

String.

So it indicates if the response is a php structure type then it would be a string.


Rate this article on a scale of 1 to 10

Your vote :  


 

Recent Jobs

Sr. Software Engineer - Analytics
Immediate Mainframe openings for Ch
Immediate TANDEM-TAL openings for C
Immediate ASP.NET/C# Openings for C
Sr. Software Engineer

View all Jobs (Add yours)
View all CV (Add yours)



cfxmasks
water softener
Teleconference
Host Department NOLIMIT Web Hosting
MSN
sunglasses
conference calls


    Email TopXML  

Front Page Daily Stuff TopXML Forum XML blogs XML Newsgroups BizTalk Biztalk Utilities Biztalk Utilities Tutorial B2B SAP XML Microsoft .NET Dotnet System XML Soapformatter SQLXML XMLserializer XQuery PHP PHP SimpleXML PHP XML Dom PHP XML RPC PHP XSLT Java Java Java XML Xalan Microsoft ASP ASP Schemas XML SQL Server XML XMLDom XSL XSL Tutorial XSLT Stylesheets General Javascript CSS XHTML WAP