本文主要是介绍PHP使用SOAP调用API,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
/*图片转换为 base64格式编码*/
function base64EncodeImage($image_file)
{$base64_image = '';$image_info = getimagesize($image_file);$image_data = fread(fopen($image_file, 'r'), filesize($image_file));//$base64_image = 'data:' . $image_info['mime'] . ';base64,' . chunk_split(base64_encode($image_data));$base64_image = chunk_split(base64_encode($image_data));return $base64_image;
}$strPhotoFront_base64 = base64EncodeImage("static/img/a.png");
$strPhotoRear_base64 = base64EncodeImage("static/img/b.png");$paras["strPhotoFront"] = $strPhotoFront_base64;
$paras["strPhotoRear"] = $strPhotoRear_base64;
$paras["strSecretKey"] = "";$wsdl = "";
$client = new SoapClient($wsdl);
$soapParas = array($paras);
$outString = $client->__soapCall("UploadPhotoId", $soapParas);
$obj = simplexml_load_string($outString->UploadPhotoIdResult->any);echo($obj->ExtraInfo);
echo "<br/>";
echo($obj->ExtraCode);
echo "<br/>";
echo($obj->Code);
echo "<br/>";
echo($obj->Message);
这篇关于PHP使用SOAP调用API的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!