查看文件: post_soap.php
大小: 3.92 KB
类型: application/octet-stream
<?php require_once('../Connections/BE2.php'); ?> <?php //$url = "https://example.com"; mysql_select_db($database_BE2, $BE2); $query_Rt2 = "SELECT * FROM billpost where bid=3 AND cpost='N' order by bid"; $Rt2 = mysql_query($query_Rt2, $BE2) or die(mysql_error()); $row_Rt2 = mysql_fetch_assoc($Rt2); $totalRows_Rt2 = mysql_num_rows($Rt2); // $url='https://invoice.paynow.com.tw/PayNowEInvoice.asmx'; // test $url='https://testinvoice.paynow.com.tw/PayNowEInvoice.asmx'; $mem_cid='42656789'; $mem_password='56789898'; $csyStr=''; //exit; $ar1=array('商家訂單編','買方統編','買方姓名','買方住址','買方手機','買方EMAIL','載具類型','載具明碼','載具隱碼','愛心碼','明細描述','數量','單價','小計','備註','發票明細稅','是否經海關'); $ar2=array('orderno','buyer_id','buyer_name','buyer_add','buyer_phone','buyer_email','CarrierType','CarrierID_1', 'CarrierID_2','LoveCode','Description','Quantity','UnitPrice','Amount','Remark','ItemTaxtype','IsPassCustoms'); //,'IsPassCustoms' //for ($i=0;$i<count($ar1);$i++){ // echo $ar1[$i].",".$ar2[$i]."<br>"; // } $l=count($ar2); do { for ($i=0;$i<$l;$i++){ $csyStr .="’".$row_Rt2[$ar2[$i]]; if($i<>$l-1){ $csyStr .=","; } } $csyStr .= chr(10); } while ($row_Rt2 = mysql_fetch_assoc($Rt2)); // echo $csyStr; // $post_value= 'mem_cid=42656789&mem_password=56789898&csyStr='.$csyStr; // $post_value= array("mem_cid"=>"42656789", "mem_password"=>"5678989","csyStr"=>$csyStr ); //'mem_cid='.$mem_cid.'&mem_password='.$mem_password.'&csyStr='.$csyStr; $b64= base64_encode($csyStr); $fields = array( 'mem_cid'=>'42656789','mem_password'=>'5678989' ,'csyStr'=> $b64 ); // 'csyStr'=> $csyStr $soap_request = '<?xml version="1.0" encoding="utf-8"?> '; $soap_request .= '<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" '; $soap_request .= ' xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">'; $soap_request .= ' <soap:Body> '; $soap_request .= ' <UploadInvoice_Patch xmlns="https://invoice.PayNow.com.tw/"> '; $soap_request .= ' <mem_cid>28229955</mem_cid> '; $soap_request .= ' <mem_password>28229955</mem_password> '; $soap_request .= ' <csvStr>'.$b64.'</csvStr> '; $soap_request .= ' </UploadInvoice_Patch> '; $soap_request .= ' </soap:Body> '; $soap_request .= '</soap:Envelope> '; echo $soap_request .'<br>'; // $pstr="mem_cid=42656789&mem_password=5678989&csyStr=".$b64; // $url='https://testinvoice.paynow.com.tw/PayNowEInvoice.asmx'; // echo $b64; // $url='https://q.yuxingo.com.tw/billtest/posttest.php'; $header = array( "Content-type: text/xml;charset=\"utf-8\"", "Accept: text/xml", "Cache-Control: no-cache", "Pragma: no-cache", "SOAPAction: \"run\"", "Content-length: ".strlen($soap_request), ); // $soapUrl ="https://testinvoice.paynow.com.tw/PayNowEInvoice.asmx";// $soap_do = curl_init(); curl_setopt($soap_do, CURLOPT_URL, "https://testinvoice.paynow.com.tw/PayNowEInvoice.asmx" ); curl_setopt($soap_do, CURLOPT_CONNECTTIMEOUT, 10); curl_setopt($soap_do, CURLOPT_TIMEOUT, 10); curl_setopt($soap_do, CURLOPT_RETURNTRANSFER, true ); curl_setopt($soap_do, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($soap_do, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($soap_do, CURLOPT_POST, true ); curl_setopt($soap_do, CURLOPT_POSTFIELDS, $soap_request); curl_setopt($soap_do, CURLOPT_HTTPHEADER, $header); $result = curl_exec($soap_do); print_r($result); curl_close($soap_do); /* if(curl_exec($soap_do) === false) { $err = 'Curl error: ' . curl_error($soap_do); curl_close($soap_do); print $err; } else { curl_close($soap_do); print 'Operation completed without any errors'; } */ ?>
保存
取消
返回文件列表