<?php $url = 'https://my602079.sapbyd.cn/sap/bc/srt/scs/sap/querysalesorderin3'; $post_data = '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:glob="http://sap.com/xi/SAPGlobal20/Global"> <soapenv:Header/> <soapenv:Body> <glob:SalesOrderByElementsQuery_sync> <!--Optional:--> <SalesOrderSelectionByElements> <SelectionByID> <!--固定值:--> <InclusionExclusionCode>I</InclusionExclusionCode> <IntervalBoundaryTypeCode>1</IntervalBoundaryTypeCode> <!--订单编号:--> <LowerBoundaryID>139</LowerBoundaryID> </SelectionByID> </SalesOrderSelectionByElements> <!--Optional:--> <ProcessingConditions> <!--固定值:--> <QueryHitsMaximumNumberValue>1</QueryHitsMaximumNumberValue> <QueryHitsUnlimitedIndicator>false</QueryHitsUnlimitedIndicator> </ProcessingConditions> </glob:SalesOrderByElementsQuery_sync> </soapenv:Body> </soapenv:Envelope>'; $name='_BYDHOST'; $pwd='Welcome1'; $author = base64_encode($name . ':' . $pwd); $header[] = 'Content-Type:text/xml; charset=utf-8'; $header[] = 'Authorization: Basic ' . $author; $curl = curl_init(); // 启动一个CURL会话 curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_HTTPHEADER, $header); curl_setopt($curl, CURLOPT_POST, 1); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($curl, CURLOPT_POSTFIELDS, $post_data); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); var_dump($response); ?>
返回的xml已获得,返回的结果转成php数组
开发预算:10
开发周期:1天