public array DomainSearch( array $searchquery )
Searches the Sedo database for domains matching the given keyword.
Type | Parameter | Mandatory | Description |
---|---|---|---|
integer | $partnerid | yes | Partner ID. |
string | $signkey | yes | Sign key. |
string | $keyword | yes | Keyword to search for. (in UTF-8 encoding) |
string | $tld | no | Top level domain to filter for. |
string | $kwtype | no |
Keyword search mode:
|
boolean | $no_hyphen | no | true only shows results without hyphen. |
boolean | $no_numeral | no | true only shows non-numerical results. |
boolean | $no_idn | no | true only shows non-IDN-domains. |
integer | $resultsize | no | Number of results (max. 1000). |
string | $language | no | ISO 639-1 two-letter language code. See Domain Languages. |
Type | Description | |||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
array |
The return value contains the following elements:
|
<?php
try {
// Create a new client by providing the endpoint to the constructor.
$client = new SoapClient(
null,
[
'location' => 'https://api.sedo.com/api/v1/',
'soap_version' => SOAP_1_1,
'encoding' => 'UTF-8',
'uri' => 'urn:SedoInterface',
'style' => SOAP_RPC,
'use' => SOAP_ENCODED,
]
);
// Set the values for the array
$params = [
'partnerid' => 1234,
'signkey' => 'abcdefghijklmnopqrstuvwxyz0123456789',
'keyword' => utf8_encode('searchkeyword'),
'tld' => 'com',
'kwtype' => 'C',
'no_hyphen' => false,
'no_numeral' => false,
'no_idn' => false,
'resultsize' => 100,
'language' => 'en',
];
// Call the SOAP method
$result = $client->DomainSearch($params);
// Display the result
echo "<table>";
echo "<tr>";
echo "<td>Nr.</td>";
echo "<td>Domain</td><td>Type</td>";
echo "<td>Price</td><td>Currency</td>";
echo "<td>Rank</td><td>URL</td>";
echo "</tr>";
for ($i = 0; $i < count($result); $i++) {
echo "<tr>";
echo "<td>".$i."</td>";
echo "<td>".$result[$i]['domain']."</td><td>".$result[$i]['price']."</td>";
echo "<td>".$result[$i]['type']."</td><td>".$result[$i]['currency']."</td>";
echo "<td>".$result[$i]['rank']."</td><td>".$result[$i]['url']."</td>";
echo "</tr>";
}
echo "</table>";
} catch (SoapFault $e) {
echo 'Error: '.$e->getMessage();
}
<?php
/* URL to Sedo's API */
$baseUrl = 'https://api.sedo.com/api/v1/DomainSearch?';
/* API function parameters */
$params = [
'partnerid' => 1234,
'signkey' => 'abcdefghijklmnopqrstuvwxyz0123456789',
'output_method' => 'xml',
'keyword' => 'example',
'tld' => '%',
'kwtype' => 'C',
'no_hyphen' => 1,
'no_numeral' => 1,
'no_idn' => 1,
'resultsize' => 25,
'language' => 'en',
];
/* build request URL */
$request = $baseUrl . http_build_query($params);
/* fire API request */
$fp = @fopen($url . $request, 'r');
/* read response line by line */
while (!@feof($fp)) {
echo fread($fp, 4096);
}
/* close the connection */
fclose($fp);
For a successful request, you will receive an XML document as response in this format:
<?xml version="1.0" encoding="UTF-8"?>
<SEDOSEARCH ver="1.0">
<item>
<domain type="xsd:string">example.com</domain>
<type type="xsd:string">D</type>
<price type="xsd:double">99.99</price>
<currency type="xsd:int">1</currency>
<rank type="xsd:int">1</rank>
<url type="xsd:string">https://sedo.com/search/details.php4?domain=example.com</url>
</item>
</SEDOSEARCH>
For an unsuccessful request, you will receive an XML document as response in this format:
<?xml version="1.0" encoding="UTF-8"?>
<SEDOFAULT ver="1.0">
<faultcode type="xsd:string">Exxx</faultcode>
<faultstring type="xsd:string">xxxxxx</faultstring>
</SEDOFAULT>
// Create package sedoapi:
// java org.apache.axis.wsdl.WSDL2Java -av -p sedoapi https://api.sedo.com/api/v1/?wsdl
import sedoapi.*;
import org.apache.axis.AxisFault;
public class SedoDomainSearch
{
public static void main(String[] args) throws Exception
{
sedoapi.SedoInterfaceServiceLocator locator = new sedoapi.SedoInterfaceServiceLocator();
sedoapi.SedoInterfacePortType port = locator.getSedoInterfacePort();
try {
DomainSearchRequest request = new DomainSearchRequest();
request.setPartnerid(1234);
request.setSignkey("abcdefghijklmnopqrstuvwxyz0123456789");
request.setKeyword("example.com");
request.setTld("%");
request.setKwtype("B");
request.setNo_hyphen(false);
request.setNo_numeral(false);
request.setNo_idn(false);
request.setResultsize(10);
request.setLanguage("en");
DomainSearchResponse[] response = port.domainSearch(request);
for (int i = 0; i < response.length; i++) {
System.out.println("Domain: " + response[i].getDomain());
System.out.println("Price: " + response[i].getPrice());
System.out.println("Type: " + response[i].getType());
System.out.println("Currency: " + response[i].getCurrency());
System.out.println("Rank: " + response[i].getRank());
System.out.println("Url: " + response[i].getUrl());
System.out.println("--------");
}
} catch (AxisFault fault) {
System.err.println("Faultcode : " + fault.getFaultCode());
System.err.println("Faultstring : " + fault.getFaultString());
}
}
}