linkemperor-api 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE +22 -0
- data/README.md +59 -0
- data/Rakefile +2 -0
- data/lib/linkemperor-api/customers.rb +470 -0
- data/lib/linkemperor-api/vendors.rb +193 -0
- data/lib/linkemperor-api/version.rb +5 -0
- data/lib/linkemperor-api.rb +4 -0
- data/linkemperor-api.gemspec +17 -0
- data/php/customers.php +450 -0
- data/php/vendors.php +173 -0
- metadata +57 -0
data/php/vendors.php
ADDED
@@ -0,0 +1,173 @@
|
|
1
|
+
|
2
|
+
<?php
|
3
|
+
class LinkemperorVendor {
|
4
|
+
function __construct($api_key) {
|
5
|
+
$this->api_key = $api_key;
|
6
|
+
$this->base_path = 'http://app.linkemperor.com';
|
7
|
+
}
|
8
|
+
function linkemperor_exec($post_data, $method_type, $uri) {
|
9
|
+
$ch = curl_init();
|
10
|
+
curl_setopt($ch, CURLOPT_URL, $this->base_path . $uri);
|
11
|
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
|
12
|
+
curl_setopt($ch, CURLOPT_USERPWD, $this->api_key . ":x");
|
13
|
+
curl_setopt($ch, CURLOPT_TIMEOUT, 60);
|
14
|
+
curl_setopt($ch, CURLOPT_HTTPHEADER, Array("Content-Type: application/json"));
|
15
|
+
if ($post_data) {
|
16
|
+
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($post_data));
|
17
|
+
}
|
18
|
+
if ($method_type) {
|
19
|
+
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method_type);
|
20
|
+
}
|
21
|
+
$data = curl_exec($ch);
|
22
|
+
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
23
|
+
if ($http_code >= 200 && $http_code < 300) {
|
24
|
+
if (strlen($data)) {
|
25
|
+
$json = json_decode($data);
|
26
|
+
return $json;
|
27
|
+
}
|
28
|
+
else {
|
29
|
+
return null;
|
30
|
+
}
|
31
|
+
}
|
32
|
+
else {
|
33
|
+
throw new Exception($data);
|
34
|
+
}
|
35
|
+
}
|
36
|
+
|
37
|
+
|
38
|
+
# We call orders placed for your link building Service a Blast.
|
39
|
+
# Use this method to retrieve all outstanding orders for your link building service(s).
|
40
|
+
#
|
41
|
+
# We will respond with the 500 first outstanding blasts for either the provided Service ID, or if none is provided, for all of your Services.
|
42
|
+
# Parameters:
|
43
|
+
# - service_id: ID of a Service. If provided, the response will be scoped to just that service ID.
|
44
|
+
public function get_blasts($service_id = null) {
|
45
|
+
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
return $this->linkemperor_exec(null, null,"/api/v2/vendors/blasts.json");
|
50
|
+
|
51
|
+
}
|
52
|
+
|
53
|
+
# Pulls the next blast from the order queue, marks it as having been started,
|
54
|
+
# and returns full information about the Blast, including Targets and Output URLs, if available.
|
55
|
+
# Parameters:
|
56
|
+
# - service_id: ID of a Service. If provided, the response will be scoped to just that service ID.
|
57
|
+
public function get_next_blast($service_id = null) {
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
|
62
|
+
return $this->linkemperor_exec(null, null,"/api/v2/vendors/blasts/next.json");
|
63
|
+
|
64
|
+
}
|
65
|
+
|
66
|
+
# Pulls a batch of blast from the order queue, marks them as having been started,
|
67
|
+
# and returns full information about the Blast, including Targets and Output URLs, if available.
|
68
|
+
# Parameters:
|
69
|
+
# - service_id: ID of a Service. If provided, the response will be scoped to just that service ID.
|
70
|
+
# - batch_size: Batch size. If not provided, the default batch size is 100
|
71
|
+
public function get_next_batch_blasts($service_id = null, $batch_size = null) {
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
return $this->linkemperor_exec(null, null,"/api/v2/vendors/blasts/next_batch.json");
|
77
|
+
|
78
|
+
}
|
79
|
+
|
80
|
+
# Once you've completed link building for a request, you need to submit the URLs where links were built. This PUT method does that.
|
81
|
+
#
|
82
|
+
# After we receive this submission, we will verify the links provided within 24 hours.
|
83
|
+
# Once the links prove to be valid, we will credit your account immediately. If we cannot
|
84
|
+
# find enough valid backlinks in the links that you provided, we will suspend payment pending a manual review.
|
85
|
+
# Parameters:
|
86
|
+
# - id: ID # of the Blast
|
87
|
+
# - links: A string containing the list of links to submit (newline delimited)
|
88
|
+
public function submit_built_link($id, $links) {
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
if(!$id) {
|
93
|
+
throw new Exception('id should not be empty');
|
94
|
+
}
|
95
|
+
|
96
|
+
if(!$links) {
|
97
|
+
throw new Exception('links should not be empty');
|
98
|
+
}
|
99
|
+
|
100
|
+
|
101
|
+
$parameters = array('blast' => array('links' => $links));
|
102
|
+
return $this->linkemperor_exec($parameters, 'PUT', "/api/v2/vendors/blasts/$id.json");
|
103
|
+
|
104
|
+
}
|
105
|
+
|
106
|
+
# Lists all available Services. This is a great way to automatically compare your service against the current competition.
|
107
|
+
# Parameters:
|
108
|
+
# none
|
109
|
+
public function get_services() {
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
|
114
|
+
return $this->linkemperor_exec(null, null,"/api/v2/vendors/services.json");
|
115
|
+
|
116
|
+
}
|
117
|
+
|
118
|
+
# Lists the full details of a specific Service.
|
119
|
+
# Parameters:
|
120
|
+
# - id: ID # of the Service
|
121
|
+
public function get_service_by_id($id) {
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
if(!$id) {
|
126
|
+
throw new Exception('id should not be empty');
|
127
|
+
}
|
128
|
+
|
129
|
+
|
130
|
+
return $this->linkemperor_exec(null, null,"/api/v2/vendors/services/$id.json");
|
131
|
+
|
132
|
+
}
|
133
|
+
|
134
|
+
# This API method looks at all the Built URLs submitted to a given Service in the last 7 days and finds domains that have never passed our link checker.
|
135
|
+
#
|
136
|
+
# This is a great way to clean your list of URLs used for submissions.
|
137
|
+
# Parameters:
|
138
|
+
# - id: ID # of the Service
|
139
|
+
public function get_failed_domains($id) {
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
if(!$id) {
|
144
|
+
throw new Exception('id should not be empty');
|
145
|
+
}
|
146
|
+
|
147
|
+
|
148
|
+
return $this->linkemperor_exec(null, null,"/api/v2/vendors/services/$id/failed_domains.json");
|
149
|
+
|
150
|
+
}
|
151
|
+
|
152
|
+
# Creates a test blast for your Service. It will not affect your score or marketplace rank. However, if you submit URLs that fail to pass our link checker, they will be reflected in the failed_domains method of the API.
|
153
|
+
#
|
154
|
+
# This is particularly useful for testing new URL lists or potential link sources.
|
155
|
+
# Parameters:
|
156
|
+
# - id: ID # of the Service
|
157
|
+
public function create_test_blast($id) {
|
158
|
+
|
159
|
+
|
160
|
+
|
161
|
+
if(!$id) {
|
162
|
+
throw new Exception('id should not be empty');
|
163
|
+
}
|
164
|
+
|
165
|
+
|
166
|
+
$parameters = array();
|
167
|
+
return $this->linkemperor_exec($parameters, 'POST', "/api/v2/vendors/services/$id/test_blast.json");
|
168
|
+
|
169
|
+
}
|
170
|
+
|
171
|
+
}
|
172
|
+
?>
|
173
|
+
|
metadata
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: linkemperor-api
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- LinkEmperor
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-04-24 00:00:00.000000000 Z
|
13
|
+
dependencies: []
|
14
|
+
description: Link Emperor API for Customers and Vendors
|
15
|
+
email:
|
16
|
+
- linkemperor@linkemperor.com
|
17
|
+
executables: []
|
18
|
+
extensions: []
|
19
|
+
extra_rdoc_files: []
|
20
|
+
files:
|
21
|
+
- .gitignore
|
22
|
+
- Gemfile
|
23
|
+
- LICENSE
|
24
|
+
- README.md
|
25
|
+
- Rakefile
|
26
|
+
- lib/linkemperor-api.rb
|
27
|
+
- lib/linkemperor-api/customers.rb
|
28
|
+
- lib/linkemperor-api/vendors.rb
|
29
|
+
- lib/linkemperor-api/version.rb
|
30
|
+
- linkemperor-api.gemspec
|
31
|
+
- php/customers.php
|
32
|
+
- php/vendors.php
|
33
|
+
homepage: http://www.linkemperor.com
|
34
|
+
licenses: []
|
35
|
+
post_install_message:
|
36
|
+
rdoc_options: []
|
37
|
+
require_paths:
|
38
|
+
- lib
|
39
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
40
|
+
none: false
|
41
|
+
requirements:
|
42
|
+
- - ! '>='
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: '0'
|
45
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
46
|
+
none: false
|
47
|
+
requirements:
|
48
|
+
- - ! '>='
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: '0'
|
51
|
+
requirements: []
|
52
|
+
rubyforge_project:
|
53
|
+
rubygems_version: 1.8.23
|
54
|
+
signing_key:
|
55
|
+
specification_version: 3
|
56
|
+
summary: Link Emperor API
|
57
|
+
test_files: []
|