Help Needed CPAgrip php script
01-24-2017, 12:35 AM
Post: #1
As of today I have joined cpagrip to monetize my android app but for know I came to a problem I am using a php script to load offers from cpagrip this works great for text based links and thumbnails but I don't know how to filter the cpagrip offers inside the php script for a certain offer.




Like " I have anti virus website so like to show only offers that are relegated to anti virus."




Plus I like to know how to make the thumbnail clickable now I have a clickable text link but I like to chance it.




Below you will find my php script that I have so far any help with would be great.




<?php

$tracking_id = 'user@gmail.com'; //This is used to track the user doing the offer. can be email, clickid, subid.. etc

$userip = $_SERVER['REMOTE_ADDR']; //We need to get the users ip, so the rss feed can display the correct offers for their country.

$user_agent = $_SERVER['HTTP_USER_AGENT']; //lets collect their user agent to pass along.

$max_offers = 3; //max number of offers to display.




$offer_cnt = 0;

$feedurl = 'http://www.cpagrip.com/common/offer_feed_rss.php?user_id=30363&key=396e73a06c1d60134cc97b01ad47803b&ip='.$userip.'&ua='.urlencode($user_agent).'&tracking_id='.urlencode($tracking_id);

if($xml = simplexml_load_file($feedurl, 'SimpleXMLElement', LIBXML_NOCDATA)) {

foreach($xml->offers->offer as $offeritem) {

$offer_cnt++;



//lets use a custom tracking domain for the links :)

$offeritem->offerlink = str_replace('www.cpagrip.com','filetrkr.com',$offeritem->offerlink);



//uncomment below if you want to display a point value.

//$points = floatval($offeritem->payout) * 100; //lets make offers worth $1.20 appear as 120 points.

//echo '<strong>Earn '.$points.' Points</strong><br/>';



echo '<a target="_blank" href="'.$offeritem->offerlink.'">'.$offeritem->title.'</a><br/>';



//uncomment to show offers description

//echo $offeritem->description.'<br/>';



//uncomment to show offers image

echo '<img src="'.$offeritem->offerphoto.'">';



if($offer_cnt>=$max_offers){

break; //lets stop listing offers and exit the loop.

}

}

if($offer_cnt==0){

echo 'Sorry there are no offers available for your region at this time.';

}

}else{

echo 'error fetching xml offer feed.';

}

?>
Reply
01-24-2017, 12:56 AM
(This post was last modified: 01-24-2017 01:01 AM by D_Gates.)
Post: #2
avatar
To only have a select amount of offers displayed, you can just disable the offers you don't want in your My Offers page.

And to make the thumbnail clickable, just put it in an anchor tag.

PHP Code:
echo '<a target="_blank" href="' $offeritem->offerlink '"><img src="' $offeritem->offerphoto '"></a>'
Reply
01-24-2017, 01:00 AM
Post: #3
avatar
Two solutions:

1. You can search for strings with the PHP function strpos() - have a look at http://www.php.net/strpos

I don't recommend this, because not every offer title contains exactly the name of your niche.

2. Import all offers into a database (SQLite, MySQL etc.), tag every offer manually with a kind of niche keyword, select the matching offers in real time. I would implement a caching system, too.

(It doesn't make sense to disable offers at CPAGrip if you run more than one niche.)

[Image: giphy.gif]

Automate your daily work with Bots!
Then you'll have more time to sleep. ;-)
Reply
01-24-2017, 01:18 AM
(This post was last modified: 01-24-2017 01:25 AM by takumi.)
Post: #4
(01-24-2017 12:56 AM)D_Gates Wrote:  To only have a select amount of offers displayed, you can just disable the offers you don't want in your My Offers page.

And to make the thumbnail clickable, just put it in an anchor tag.

PHP Code:
echo '<a target="_blank" href="' $offeritem->offerlink '"><img src="' $offeritem->offerphoto '"></a>'

That was a great solution to make the images clickable in php I am not that great with php to be honest so I am very grateful for the fast and accurate solution. Thanks for the great help.

(01-24-2017 01:00 AM)CharlieHarper Wrote:  Two solutions:

1. You can search for strings with the PHP function strpos()

I don't recommend this, because not every offer title contains exactly the name of your niche.

2. Import all offers into a database (SQLite, MySQL etc.), tag every offer manually with a kind of niche keyword, select the matching offers in real time. I would implement a caching system, too.

(It doesn't make sense to disable offers at CPAGrip if you run more than one niche.)

I agree that disabling the offers is maybe a solution on short term but when I am going to run multiple sites then this will become a problem.

Is it possible to use the PHP function strops in combination with csv that cpagrip provides? I am not very great in using php so just asking. On a side note what do you think is better for this php or json for desktop or mobile devices.
Reply
01-24-2017, 04:47 AM
Post: #5
After taking a closer look in to the documents inside cpagrip I have found that they load the offers via the offer id.

This seems a valid approach the offer id looks like this &id=9977 now come a question how can I implement this in the php script above and can I use multiple ids to count for the different country's.

This would act like a filter for niche specific offer in my opinion unless I am mistaken love to hear your thoughts or solutions about this.
Reply

Share This:


Elites Related Threads
Thread: Author Views: Last Post
Help needed - Download link freakkz 137 01-29-2017 10:23 PM
Last Post: CharlieHarper
[HELP NEEDED] I have a question about what to do in my project! Fpsroca 207 01-10-2017 09:05 AM
Last Post: Fpsroca
[HELP NEEDED] Embedding P*rn videos to my adult WordPress Site appreciate 627 01-09-2017 03:18 AM
Last Post: appreciate
Lockers (with iframe and without) help needed. Will pay with PP bebriukas 555 11-26-2016 02:56 PM
Last Post: MIG92
CPAGrip Offer Walls Help Arthod 402 11-23-2016 02:44 AM
Last Post: Arthod





© 2013-2017 CPA Elites Ltd
Enhanced by MyBB and WallBB
Return to top