接口地址:http://api.gamesup.cn/purchaseinterface/SupPurchaseInterface.asmx
以下是接口的一个请求和返回案例,这个怎么用php写访问进行数据交换,是用soap吗?
求大神给个思路SOAP 1.1
The following is a sample SOAP 1.1 request and response. The placeholders shown need to be replaced with actual values.POST /purchaseinterface/SupPurchaseInterface.asmx HTTP/1.1
Host: api.gamesup.cn
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://www.gamesup.cn/purchaseinterface/SupPay"<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<SupPay xmlns="http://www.gamesup.cn/purchaseinterface/">
<MerchantID>int</MerchantID>
<ProductID>int</ProductID>
<Num>int</Num>
<MSalePrice>decimal</MSalePrice>
<AccountName>string</AccountName>
<OrderNo>string</OrderNo>
<ReturnUrl>string</ReturnUrl>
<Ip>string</Ip>
<Sign>string</Sign>
<Datas>string</Datas>
</SupPay>
</soap:Body>
</soap:Envelope>
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<SupPayResponse xmlns="http://www.gamesup.cn/purchaseinterface/">
<SupPayResult>string</SupPayResult>
</SupPayResponse>
</soap:Body>
</soap:Envelope>
SOAP 1.2
The following is a sample SOAP 1.2 request and response. The placeholders shown need to be replaced with actual values.POST /purchaseinterface/SupPurchaseInterface.asmx HTTP/1.1
Host: api.gamesup.cn
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Body>
<SupPay xmlns="http://www.gamesup.cn/purchaseinterface/">
<MerchantID>int</MerchantID>
<ProductID>int</ProductID>
<Num>int</Num>
<MSalePrice>decimal</MSalePrice>
<AccountName>string</AccountName>
<OrderNo>string</OrderNo>
<ReturnUrl>string</ReturnUrl>
<Ip>string</Ip>
<Sign>string</Sign>
<Datas>string</Datas>
</SupPay>
</soap12:Body>
</soap12:Envelope>
HTTP/1.1 200 OK
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Body>
<SupPayResponse xmlns="http://www.gamesup.cn/purchaseinterface/">
<SupPayResult>string</SupPayResult>
</SupPayResponse>
</soap12:Body>
</soap12:Envelope>
以下是接口的一个请求和返回案例,这个怎么用php写访问进行数据交换,是用soap吗?
求大神给个思路SOAP 1.1
The following is a sample SOAP 1.1 request and response. The placeholders shown need to be replaced with actual values.POST /purchaseinterface/SupPurchaseInterface.asmx HTTP/1.1
Host: api.gamesup.cn
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://www.gamesup.cn/purchaseinterface/SupPay"<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<SupPay xmlns="http://www.gamesup.cn/purchaseinterface/">
<MerchantID>int</MerchantID>
<ProductID>int</ProductID>
<Num>int</Num>
<MSalePrice>decimal</MSalePrice>
<AccountName>string</AccountName>
<OrderNo>string</OrderNo>
<ReturnUrl>string</ReturnUrl>
<Ip>string</Ip>
<Sign>string</Sign>
<Datas>string</Datas>
</SupPay>
</soap:Body>
</soap:Envelope>
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<SupPayResponse xmlns="http://www.gamesup.cn/purchaseinterface/">
<SupPayResult>string</SupPayResult>
</SupPayResponse>
</soap:Body>
</soap:Envelope>
SOAP 1.2
The following is a sample SOAP 1.2 request and response. The placeholders shown need to be replaced with actual values.POST /purchaseinterface/SupPurchaseInterface.asmx HTTP/1.1
Host: api.gamesup.cn
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Body>
<SupPay xmlns="http://www.gamesup.cn/purchaseinterface/">
<MerchantID>int</MerchantID>
<ProductID>int</ProductID>
<Num>int</Num>
<MSalePrice>decimal</MSalePrice>
<AccountName>string</AccountName>
<OrderNo>string</OrderNo>
<ReturnUrl>string</ReturnUrl>
<Ip>string</Ip>
<Sign>string</Sign>
<Datas>string</Datas>
</SupPay>
</soap12:Body>
</soap12:Envelope>
HTTP/1.1 200 OK
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Body>
<SupPayResponse xmlns="http://www.gamesup.cn/purchaseinterface/">
<SupPayResult>string</SupPayResult>
</SupPayResponse>
</soap12:Body>
</soap12:Envelope>
$curl=<<<EOD
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<Query xmlns="http://www.gamesup.cn/purchaseinterface/">
<MerchantID>int</MerchantID>
<OrderNo>string</OrderNo>
</Query>
</soap:Body>
</soap:Envelope>
EOD;
$head=array("Content-type: text/xml;charset=utf-8" ,
"Host: api.gamesup.cn",
"SOAPAction: http://www.gamesup.cn/purchaseinterface/Query",
"Content-Length: ".mb_strlen($curl),
);
var_dump(post_curl("http://api.gamesup.cn/purchaseinterface/SupPurchaseInterface.asmx",$curl,$head));function curl_post($url,$data,$host)
{
$ch = curl_init();
$res= curl_setopt ($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt ($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch,CURLOPT_HTTPHEADER,$host);
$result = curl_exec ($ch);
curl_close($ch);
if ($result == NULL) {
return 0;
}
return $result;
}