· 6 years ago · Oct 10, 2019, 01:18 AM
1OFFERWALL:
2
3I have a script on my site that acts as a task wall and grabs offers from my affiliate network - then credits them upon conversion through a post back ( already set up )
4
5What I want to do is I want to pull other affiliate networks offers via API through a button ( "Show All Other Offers" ) so that they can do more offers.
6
7
8
9
10Sample of Integrations:
11
12
13The Current Network I am using:(sample)
14https://mobverify.com/api/v1/?affiliateid=32281&country=US&device=android&ctype=1
15Documentation: https://i.imgur.com/ay9yADo.png https://i.imgur.com/TzuC09s.png
16
17
18ADLUDUM
19<script type="text/javascript" src="//www.lucyfeed.com/7LVGuwdVoBBE5PwZ"></script>
20<div class="ludy-options" data-offers="7LVGuwdVoBBE5PwZ"></div>
21
22
23CPABUILD
24b505f0b8cff3da0b3a881f2b1061d28c - OFFER KEY
25Sample Code
26
27<div id="offerContainer"></div>
28
29<!--WARNING - THIS IS AN OLD JQUERY VERSION-->
30<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
31<script type="text/javascript">
32 $(function() {
33 $.getJSON("http://cpabuild.com/public/offers/feed.php?user_id=1049&api_key=b505f0b8cff3da0b3a881f2b1061d28c&s1=&s2=&callback=?",
34 function(offers){
35 var html = '';
36 var numOffers=5; //Change to trim offers. Max is 10.
37 offers=offers.splice(0,numOffers);
38 $.each(offers, function(key, offer){
39 html += '<div><a href="'+offer.url+'" target="_blank" title="'+offer.conversion+'">'+offer.anchor+'</a></div>';
40 });
41 $("#offerContainer").append(html);
42 });
43 });
44</script>
45
46
47
48
49
50=======================
51
52
53
54
55
56
57
58
59
60
61
62
63BELOW IS CURRENT PHP SCRIPT I AM USING FOR TASKWALL
64
65
66<?php
67
68
69/* Set the Browser Title */
70$header_title = "Complete Tasks & Earn!";
71
72/* Include the Header */
73require_once("header.php");
74
75/* The website Header */
76include("website_header.php");
77
78/* Mobile Detect */
79include("assets/plugins/Mobile-Detect-2.8.33/Mobile_Detect.php");
80
81
82$referal_link = htmlspecialchars($ref_url).'/'.htmlspecialchars($_SESSION["username"]);
83
84$query=$db->prepare("SELECT * FROM accounts WHERE username = :username");
85$query->bindValue(":username", $_SESSION['username']);
86$query->execute();
87$data=$query->fetch();
88
89$userId = htmlspecialchars($data['id']);
90
91//Detect which device we got here
92$detect = new Mobile_Detect;
93
94if ($detect->isAndroidOS()){
95 $device = "android";
96 $ctype = 1;
97}
98
99elseif ($detect->isiPhone()){
100 $device = "iphone";
101 $ctype = 1;
102}
103
104elseif ($detect->isiPad()){
105 $device = "ipad";
106 $ctype = 1;
107}
108
109else {
110 $device = "desktop";
111 $ctype = 2;
112}
113$affid = $ogadsAffid;
114function escape_url($url){
115 $parts = parse_url($url);
116 $path_parts = array_map('rawurldecode', explode('/', $parts['path']));
117
118 return
119 $parts['scheme'] . '://' .
120 $parts['host'] .
121 implode('/', array_map('rawurlencode', $path_parts))
122 ;
123}
124function getOffers($ctype,$affid,$affSub4,$device,$payout){
125
126 //Set ip from Cloudflare if we are behind cloudflare
127 if (isset($_SERVER["HTTP_CF_CONNECTING_IP"])) {
128 $_SERVER['REMOTE_ADDR'] = $_SERVER["HTTP_CF_CONNECTING_IP"];
129 }
130 $affSub3 = $payout;
131
132 $url = "https://mobverify.com/api/v1/?affiliateid=".$affid."&ip=".urlencode($_SERVER['REMOTE_ADDR'])."&ctype=".$ctype."&device=".urlencode($device)."&aff_sub3=".urlencode($affSub3)."&aff_sub4=".urlencode($affSub4);
133
134 //initialize curl
135 $ch = curl_init();
136
137 //setup curl options
138 curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
139 curl_setopt($ch, CURLOPT_HEADER, 0);
140 curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
141 curl_setopt($ch, CURLOPT_URL, $url);
142 curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
143
144 //make request
145 $response = curl_exec($ch);
146 $json = json_decode($response, true);
147 curl_close($ch);
148 return $json;
149}
150
151
152
153?>
154<script>
155function moretasks() {
156 swal.fire({
157 title: "Multiple Tasks",
158 html: '<p>If you want to complete tasks more than once, you can do so by using another device. For example, if you complete a task on your iPhone you can complete it again on your <b>computer</b> or <b>old iPhone</b> or <b>other Device that has not been used to complete it yet.</b></p><p>Ready to continue?</p>',
159 type: "info",
160 confirmButtonText: "Continue"
161 });
162};
163function taskstut() {
164 swal.fire({
165 title: "Tutorial",
166 html: `<p>Watch the following video to learn how to properly complete tasks in the Task Wall.</p><br><br> <iframe style="width: 100%; height: 250px" src="<?php echo $youtube_taskvideo; ?>" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>`,
167 type: "info",
168 });
169};
170</script>
171<div class="wrapper">
172 <?php
173 /* The Menu */
174 include("menu.php");
175 ?>
176 <div class="content-area overflow-hidden">
177 <div class="page-header">
178 </div>
179 <div class="row">
180 <div class="rewards-body" style="overflow: visible; width:100%;">
181 <div class="offers" id="cd-nav" style="border-radius: 20px; padding: 8px;">
182 <!-- Info -->
183 <h4 style="text-align:center;">Task Wall</h4>
184 <p>Complete the easy tasks below to earn extra money. This will be automatically added to your account within 5-10 minutes.</p>
185 <p>You can only complete each offer <strong style="font-weight: bold;">ONCE</strong></p>
186 <?php if ($youtube_taskvideo != "") { ?>
187 <p><a onclick="taskstut();" style="color: #03A9F4; cursor:pointer;">How to complete tasks video</a></p>
188 <?php } ?>
189 <p><button type="submit" onclick="moretasks();" class="btn btn-lg btn-primary">Want to complete Tasks more than once?</button></p>
190
191 <div class="offerlist">
192 <br>
193 <div class="offerlistDevider"></div>
194
195 <?php
196 //Get app installs
197 $ctype = 1;
198 if($device == 'desktop') {
199 $price_apps = $price_survey;
200 }
201 else {
202 $price_apps = $price_apps;
203 }
204 $json = getOffers($ctype,$affid,$userId,$device,$price_apps);
205 foreach ($json['offers'] as $offer) {
206
207 ?>
208
209 <a target="_blank" href="instructions.php?offername=<?php echo urlencode($offer['name_short']);?>&imgurl=<?php echo urlencode($offer['picture']);?>&downloadurl=<?php echo urlencode($offer['link']);?>&adcopy=<?php echo str_replace('to unlock this content.','',$offer['adcopy']);?>&payout=<?php echo $price_apps ?>">
210 <div class="offer">
211 <div class="offerimg"><img src="<?php echo $offer['picture'];?>"></div>
212 <div class="offerinfo">
213 <h3><?php echo $offer['name_short'];?></h3>
214 <p><?php echo str_replace('to unlock this content.','',$offer['adcopy']);?> to earn <b>$<?php echo $price_apps; ?></b>.</p>
215 </div>
216 <div class="download">
217 <div class="btn-o">
218 <h4>Earn $<?php echo $price_apps; ?></h4>
219 </div>
220 </div>
221 </div>
222 </a>
223 <?php
224 }
225 ?>
226 <br>
227 <div class="offerlistDevider"></div>
228 <?php
229 //Get Pin and CPA
230 if($device != 'desktop') {
231 $ctype = 4;
232 $json = getOffers($ctype,$affid,$userId,'desktop',$price_survey);
233 foreach ($json['offers'] as $offer) {
234
235
236 ?>
237
238 <a target="_blank" href="instructions.php?offername=<?php echo urlencode($offer['name_short']);?>&imgurl=<?php echo urlencode($offer['picture']);?>&downloadurl=<?php echo urlencode($offer['link']);?>&adcopy=<?php echo str_replace('to unlock this content.','',$offer['adcopy']);?>&payout=<?php echo $price_survey ?>">
239 <div class="offer">
240 <div class="offerimg"><img src="<?php echo $offer['picture'];?>"></div>
241 <div class="offerinfo">
242 <h3><?php echo $offer['name_short'];?></h3>
243 <p><?php echo $offer['adcopy'];?> to earn <b>$<?php echo $price_survey; ?></b>.</p>
244 </div>
245 <div class="download">
246 <div class="btn-o">
247 <h4>Earn $<?php echo $price_survey; ?></h4>
248 </div>
249 </div>
250 </div>
251 </a>
252 <?php
253 }}
254 ?>
255 </div>
256 </div>
257 </div>
258 </div>
259 </div>
260</div>
261
262
263
264<?php
265/* Include the Footer */
266require_once("footer.php");
267
268?>
269
270
271===-----------------=====
272
273
274POST BACK SCRIPT
275
276<?php
277// Set postback to: http://yoursite.com/dashboard/postbacker.php?aff_sub3={aff_sub3}&aff_sub4={aff_sub4}
278
279require("config/config.inc.php");
280require("config/db.inc.php");
281$payout = htmlspecialchars($_GET['aff_sub3']);
282$userid = htmlspecialchars($_GET['aff_sub4']);
283
284$query=$db->prepare("UPDATE accounts SET total_earning = total_earning+:payout, task_completed = task_completed+:task WHERE id = :id");
285$query->bindValue(":id", $userid);
286$query->bindValue(":payout", $payout);
287$query->bindValue(":task", "1");
288$query->execute();
289
290echo "ok";