发送包含带有curl和PHP 7的文件的XML

时间:2019-03-09 12:18:47

标签: php xml curl

XML有一个标签,用于指示文件的路径,他们告诉我必须使用DIME进行装运。

$URL = "http://localhost:8080/data/info/USD_R11_WebService?wsdl";
$ch = curl_init();
 $xml='
 '.$sid.'rep_doc:1002iss:519605Adjunto_Evidencia/home/sftpserver/jperoza/public_html/data/uploads/28.png';
 $headers = array();
 array_push($headers, "Content-Type: multipart/form-data;application/xml; charset=US-ASCII");
 array_push($headers, "Content-Disposition: form-data; name='chg'");
 array_push($headers, "SOAPAction: '';");
 if($xml != null) {
     curl_setopt($ch, CURLOPT_POSTFIELDS, "$xml");
     array_push($headers, "Content-Length: " . strlen($xml));
 }
 curl_setopt($ch, CURLOPT_URL,$URL);
 curl_setopt($ch, CURLOPT_USERAGENT,'Jakarta Commons-HttpClient/3.0.1');
 curl_setopt($ch, CURLOPT_VERBOSE, 1);
 curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
 curl_setopt($ch, CURLOPT_POST, 1);
 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
 curl_setopt($ch, CURLOPT_POSTFIELDS, $xml);
 curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);



 if (curl_errno($ch)) 


{
     // moving to display page to display curl errors
       echo curl_errno($ch) ;
       echo curl_error($ch);
 } 
 else 
 {
     //getting response from server
     $response = curl_exec($ch);
      print_r($response);
      curl_close($ch);
 }

执行后,我得到超出消息策略限制(没有附件)的信息,与CA服务台集成在一起

stackoverflow删除xml标签,但是如果有的话

0 个答案:

没有答案