PHP xml-rpc远程调用
作者 佚名技术
来源 NET编程
浏览
发布时间 2012-05-25
_exists("$key type", $data)){ $type = $data["$key type"]; } $temp[] = array(''name'' => $key, ''value'' => XMLRPC_prepare($value, $type)); } } } } }else{ #it''s a scalar if(!$type){ if(is_int($data)){ $returnvalue[''int''] = $data; return $returnvalue; }elseif(is_float($data)){ $returnvalue[''double''] = $data; return $returnvalue; }elseif(is_bool($data)){ $returnvalue[''boolean''] = ($data ? 1 : 0); return $returnvalue; }elseif(preg_match(''/^\d{8}T\d{2}:\d{2}:\d{2}$/'', $data, $matches)){ #it''s a date $returnvalue[''dateTime.iso8601''] = $data; return $returnvalue; }elseif(is_string($data)){ $returnvalue[''string''] = htmlspecialchars($data); return $returnvalue; } }else{ $returnvalue[$type] = htmlspecialchars($data); } } return $returnvalue; } function & XMLRPC_adjustValue($current_node){ if(is_array($current_node)){ if(isset($current_node[''array''])){ if(!is_array($current_node[''array''][''data''])){ #If there are no elements, return an emptyempty array return array(); }else{ #echo "Getting rid of array -> data -> value<br>\n"; $temp = $current_node[''array''][''data''][''value'']; if(is_array($temp) and array_key_exists(0, $temp)){ $count = count($temp); for($n=0;$n<$count;$n++){ $temp2[$n] = &XMLRPC_adjustValue($temp[$n]); } $temp = $temp2; }else{ $temp2 = &XMLRPC_adjustValue($temp); $temp = array($temp2); #I do the temp assignment because it avoids copying, # since I can put a reference in the array #PHP''s reference model is a bit silly, and I can''t just say: # $temp = array(&XMLRPC_adjustValue($temp)); } } }elseif(isset($current_node[''struct''])){ if(!is_array($current_node[''struct''])){ #If there are no members, return an emptyempty array return array(); }else{ #echo "Getting rid of struct -> member<br>\n"; $temp = $current_node[''struct''][''member'']; if(is_array($temp) and array_key_exists(0, $temp)){ $count = count($temp); for($n=0;$n<$count;$n++){ #echo "Passing name {$temp[$n][name]}. Value is: " . show($temp[$n][value], var_dump, true) . "<br>\n"; $temp2[$temp[$n][''name'']] = &XMLRPC_adjustValue($temp[$n][''value'']); #echo "adjustValue(): After assigning, the value is " . show($temp2[$temp[$n][''name'']], var_dump, true) . "<br>\n"; } }else{ #echo "Passing name $temp[name]<br>\n"; $temp2[$temp[''name'']] = &XMLRPC_adjustValue($temp[''value'']); } $temp = $temp2; } }else{ $types = array(''string'', ''int'', ''i4'', ''double'', ''dateTime.iso8601'', ''base64'', ''boolean''); $fell_through = true; foreach($types as $type){ if(array_key_exists($type, $current_node)){ #echo "Getting rid of ''$type''<br>\n"; $temp = $current_node[$type]; #echo "adjustValue(): The current node is set with a type of $type<br>\n"; $fell_through = false; break; } } if($fell_through){ $type = ''string''; #echo "Fell through! Type is $type<br>\n"; } switch ($type){ case ''int'': case ''i4'': $temp = (int)$temp; break; case ''string'': $temp = (string)$temp; break; case ''double'': $temp = (double)$temp; break; case ''boolean'': $temp = (bool)$temp; brea |
凌众科技专业提供服务器租用、服务器托管、企业邮局、虚拟主机等服务,公司网站:http://www.lingzhong.cn 为了给广大客户了解更多的技术信息,本技术文章收集来源于网络,凌众科技尊重文章作者的版权,如果有涉及你的版权有必要删除你的文章,请和我们联系。以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢! |
你可能对下面的文章感兴趣
上一篇: PHP如何禁止图片文件的被盗链下一篇: PHP中使用FCKeditor2.3.2配置
关于PHP xml-rpc远程调用的所有评论