$numberLookup = $client->createNumberLookup('65123456789');
In order to perform a Number Lookup you will need the mobile number. The mobile number must always be in international format, without leading `+` or `00`. In international format means that you have add the country prefix to the local number. For example, if the country prefix is `+31` and the local number is `0612345678`, you remove the leading `0` of the local number and prepend the country prefix. As you then have to strip the leading `+` or `00`, the result will be `31612345678`.
Number Lookup result
Now our platform will perform the number lookup. To get the status of a number lookup, there a few options. You can simply get the status of the number lookup by the id when submitting the number lookup, poll for number lookups results or receive a HTTP call from our system. More information on that you can find in our API documentation. For this tutorial we will simply get the status based on the id.
Example to get the status of a number lookup:
$result = $client->getNumberLookup($numberLookup->getMessageId());
Example of the data returned by the API:
"applicationTag": "Default application",
So what can we do with the returned information?
With the information returned by the API you can do several things:
- When the `status` is `delivered` it means the number is a valid number and still active.
- By the `countryCode` field you can see in which country the mobile number is registered in. This is a two-digit ISO country code.
- The `operator` field gives the name of the actual operator the mobile number is subscribed to.
- The `isPorted` field shows information if the number is ported or not. Ported means that the subscriber change from operator and took his mobile number with him. It depends on the country if mobile numbers can be ported or not.
- The `isRoaming` field show information if the number is currently not in his home country. For example when someone is on holiday or on a business trip.
When the status of the number lookup is `delivered`, the `countryCode` and `operator` are always set. The `isPorted` and `isRoaming` might not be set. This depends if there is enough information returned by the operators for the API to detect this.