XHTML Provider
Introduction
Sample
Parameters
Details
Examples
Introduction
The XHTML Provider returns XHTML snippets specific to the matched device for enabling device functions such as click-to-call.
Sample
XHTML Provider usage urls must be in the following format:
http://www.mobileelements.com/XHTMLProvider?key=00000000000000000000000000000000&type=click_to_call&ua=iphone
This example will match on the http request useragent and return the XHTML snippet for the click-to-call functionality for that device:
tel:
The API is intended to be called from server side code. Examples in different languages can be found below.
Parameters
Parameters are separated with the ampersand (&) character. You can specify the parameters in any order.
| Parameter | Description | Required? |
|---|---|---|
| key | Your user key (view My Account to retrieve your key) | Yes |
| type |
The type of functionality required. Possible values are: click_to_call click_to_email click_to_mms click_to_sms iphone_header |
No (Default is click_to_call) |
| ua | The useragent string to override | No (Default is the http request useragent) |
Details
Examples
PHP
<?php
$snippet = "";
$f = fopen( "http://www.mobileelements.com/XHTMLProvider?key=00000000000000000000000000000000&type=click_to_call&ua=iphone", "r" );
while( $data = fread( $f, 4096 ) ) { $snippet .= $data; }
fclose( $f );
echo("<a href=\"".$snippet."+1415000000\">Click-To-Call</a>" );
?>
C#
using System;
using System.Net;
public class MobileInternetToolkit
{
public static void Main(string[] args)
{
WebClient client = new WebClient();
string snippet = client.DownloadString("http://www.mobileelements.com/XHTMLProvider?key=00000000000000000000000000000000&type=click_to_call&ua=iphone");
Console.WriteLine(string.Format("<a href=\"{0}+1415000000\">Click-To-Call</a>", snippet));
}
}
Java
import java.io.*;
import java.net.*;
public class MobileInternetToolkit {
public static void main(String[] args)
throws IOException {
URL mobileelements = new URL("http://www.mobileelements.com/XHTMLProvider?key=00000000000000000000000000000000&type=click_to_call&ua=iphone");
URLConnection connection = mobileelements.openConnection();
BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
String snippet = in.readLine();
System.out.println("<a href=\"" + snippet + "+1415000000\">Click-To-Call</a>");
in.close();
}
}
Back to Top




+