• Welcome to the Chevereto User Community!

    Here, users from all over the world come together to learn, share, and collaborate on everything related to Chevereto. It's a place to exchange ideas, ask questions, and help improve the software.

    Please keep in mind:

    • This community is user-driven. Always be polite and respectful to others.
    • Support development by purchasing a Chevereto license, which also gives you priority support.
    • Go further by joining the Community Subscription for even faster response times and to help sustain this space

Redirect using Adf.ly Api

I'm not familiar with the adf.ly API. Where I can find the documentation?
 
in user account panel > http://adf.ly/publisher/tools#tools-api

i used the curl to make a url

This the documention
Adf.ly provides you with a simple, yet useful API for your application. Simply have your application access a URL like the following example:
http://api.adf.ly/api.php?key=923f7...=int&domain=adf.ly&url=http://somewebsite.com

Replace "http://somewebsite.com" with whatever URL you are wanting shortened. The "key" and "uid" fields must be as they are above or the request will return an error.
Replace "advert_type=int" with "advert_type=banner" if you require the Framed Banner advertising option.
Replace "domain=adf.ly" with "domain=q.gs" if you wish to use our q.gs domain.
The shortened URL will be returned to you in the body of the response in plain text. If the request was unsuccessful for any reason you will receive "error" as your response. If the exact link you request is already in your account, the original shortened URL will be returned to you and no new entry added to your account.
There will most likely be special characters in the URL you send, so you must encode the URL with Javascript's encodeURIComponent() or its equivalent in other languages, otherwise your request will fail.
 
You can add this code:

Code:
<script type="text/javascript">
    var adfly_id = YOUR_ID;
    var adfly_advert = 'int';
    var frequency_cap = 5;
    var frequency_delay = 5;
    var init_delay = 3;
</script>
<script src="http://cdn.adf.ly/js/entry.js"></script>

Just below this:
PHP:
<?php include_theme_header(); ?>

In the file content/themes/<YOUR THEME>/view.php
 
You can add this code:

Code:
<script type="text/javascript">
    var adfly_id = YOUR_ID;
    var adfly_advert = 'int';
    var frequency_cap = 5;
    var frequency_delay = 5;
    var init_delay = 3;
</script>
<script src="http://cdn.adf.ly/js/entry.js"></script>

Just below this:
PHP:
<?php include_theme_header(); ?>

In the file content/themes/<YOUR THEME>/view.php
this is a good way, but adblocker's , blocked this code in default. and many user's use ad blocker plugins!

No Way to Redirect to adf.ly before loading the target page?
i used curl :
Code:
$url="http://demo.chevereto.com/image/uq5";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"http://api.adf.ly/api.php?key=923f71397b4bfc11aecebd7ac75e5958&uid=1939474&advert_type=int&domain=adf.ly&url=".$url."");
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
$content=curl_exec ($ch);
curl_close ($ch);
Before loading page , first go to adf.ly :
Code:
header("HTTP/1.1 301 Moved Permanently");
header("Location: $content");
and then after click on "SKIP ADS" They can go to http://demo.chevereto.com/image/uq5
 
I now understand what you need. The way to do it could be in the theme file view.php and in the top to that file you could start a session handler. Detect if the user comes from a fresh request and when that happens do the adf.ly thing (save the session visitor and then do a php redirect).

Then this adf.ly to chevereto request will have the session data that will tell you that this visitor have already saw the adfly code.

Do you understand?
 
I now understand what you need. The way to do it could be in the theme file view.php and in the top to that file you could start a session handler. Detect if the user comes from a fresh request and when that happens do the adf.ly thing (save the session visitor and then do a php redirect).

Then this adf.ly to chevereto request will have the session data that will tell you that this visitor have already saw the adfly code.

Do you understand?

Can You Place A sample Code for this Solution?
 
Not at this time because since yesterday (Sat 17hrs) my computer is dead and is likely to be dead until wednesday. Before you ask my video card died.
 
I'm sorry.. I'm abstracted doing the v3. What if I bundle adfly support for v3?
 
Yeah I mean, my goal is to bundle most wanted features for v3 and this could be great. However, I can't spend time on it right now.
 
Back
Top