Partner With Link Emperor

Link Building Partner API for PHP

If you use PHP, we've made our API even easier for you. The Link Emperor PHP SDK is written in straight PHP and should run anywhere PHP is available. The only requirements are the cURL module and the SimpleXML module, both of which are available on almost all hosts.

First, you'll want to download the SDK package. You can get it here. Untar it and upload it to your application directory.

linkemperor.lib.php is the only file that matters. The other files included in the tarball are sample implementations you can look at.

You'll want to look in the providers subfolder for sample code related to Link Building Partners.

Authentication

To use the API, you first need to create a Link Building Partner Program account. Once you've created the account, login and take a look at the Settings tab. It will display an API Key. This API Key must be set in the linkemperor.lib.php file. Your API Key must be kept secure, as it allows full access to your partner account via the API. If you feel that your API Key is compromised, please contact us immediately to disable it!

Retrieving Link Building Requests

We call orders placed for your link building service a "request." To retrieve all outstanding orders for your link building service(s), just call the linkemperor_requests() function. It optionally accepts one parameter, the ID of the service to retrieve requests for. When called with no parameters, it returns requests for all services. Here is an example:

/* Get all unfilled requests */
$requests = linkemperor_requests($my_service_id);
foreach ($requests as $request) {
  echo "Request #" . $request->id . " - " . $request->linkbuilding_service_name . "\n";
  // also available: 
  //   $request->linkbuilding_service_id, $request->created_at
  
  /* Get the orders in this request and process them ... */
  
}

This function will only return the first 500 requests in the queue. We hope that you don't let your queue get bigger than that anyway!

You'll want to check periodically for new orders. If running an automated service, we recommend you check every hour. Please do not check more than 5 times per hour. We can also ping a URL on your web server when new requests are made. You can set this up on the Settings tab of your account.

As soon as you see requests appear here, you should begin filling them. We track the average time it takes each partner to fill requests, so the sooner you can do it, the better.

Retrieving the Details of a Link Building Request

To get the details of a link building request, just call the linkemperor_request() function. It accepts one parameter: the request ID. Here is an example:

/* Get all unfilled requests */
$requests = linkemperor_requests();
foreach ($requests as $request) {
  echo "Request #" . $request->id . " - " . $request->linkbuilding_service_name . "\n";
  
  /* Get the orders in this request */
  $request = linkemperor_request($request->id);
  $orders = $request->linkbuilding_orders->linkbuilding_order;
  // also available: 
  //   $request->linkbuilding_service_id, $request->created_at, 
  //   $request->article_title, $request->article_body,
  //   $request->article_spun_title, $request->article_spun_body
  
  foreach ($orders as $order) {
    echo "  " . $order->url . " ~ " . $order->anchor_text . "\n";
    // also available: $order->title, $order->description, $order->category, $order->tags
  }

}

This example is included in the source tarball as providers/index.php.

Note that the anchor_text, category, tags, title and description elements will only be provided if you specified that your service requires them when creating the service.

Fulfilling Link Building Requests

Once you've completed link building for a request, you need to submit the URLs where links were built. To do that, you call the linkemperor_fulfill() function. It accepts 2 parameters: The request ID, and a newline (\n)-separated list of links.

Here is an example:

/* example, assumes that we are filling request #123 with these links */
$id = 123;
$links = "http://link1.com/1\nhttp://link2.com/2";

linkemperor_fulfill($id, $links);

This example is included in the source tarball as providers/fulfill.php.

After we receive this submission, we will verify the links provided within 24 hours. Once the links prove to be valid, we will credit your account immediately. If we cannot find enough valid backlinks in the links that you provided, we will suspend payment pending a manual review.

Additional API Operations

We plan to release additional API operations in the future. However, we're not really sure what our partners need. So if you have suggestions, please let us know.

Getting help with the API

If you're having trouble with the API, just contact us and we'll be happy to help.