PHP w/ cURL Example

From CDYNE Wiki
Jump to: navigation, search

CheckPhoneNumber

<?php
 
$xml='<?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>
<CheckPhoneNumber xmlns="http://ws.cdyne.com/PhoneVerify/query">
<PhoneNumber>17575449510</PhoneNumber>
<LicenseKey> f01d89fd-5155-5455-5585-e84ab8de8591</LicenseKey>
</CheckPhoneNumber>
</soap:Body>
</soap:Envelope>'
;
 
$headers = array(
"POST HTTP/1.1",
"Host: ws.cdyne.com",
"Content-type: text/xml; charset=\"utf-8\"",
"SOAPAction: \"http://ws.cdyne.com/PhoneVerify/query/CheckPhoneNumber\"");
 
$url = "http://ws.cdyne.com/phoneverify/phoneverify.asmx?op=CheckPhoneNumber";
 
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url );
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true );
curl_setopt($ch, CURLOPT_POST,1 );
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POSTFIELDS, $xml);
$response = htmlspecialchars(curl_exec($ch));
curl_close($ch);
print_r($response);
 
?>
Personal tools
Namespaces

Variants
Actions
Navigation
Tools

Trial Key