Mobile advertising at ads.2wap.org

Started on the old forum in November 2009 · view the original in the archive · old links redirect here

23 replies · 2,038 views · started 17 years ago · 1 min read

TL;DR · summary of 23 replies
  • slayder suggested changing the ads.2wap.org URL because it generated an error on their PHP/wml pages.
  • GumSlone provided a function for using curl ad requests and promised to add this new ad code to publisher accounts soon.
  • The PayPal payment system issue was resolved, with GumSlone updating the API and providing instructions for advertisers to use the latest install codes.

Written automatically from the replies by a language model on our own server. It can be wrong; the posts below are the source.

13 participants
GiLL Senior · 356 posts #21

paypal payment system doesn't work for advertiser could you check api again ?

left wap stuff

GumSlone Administrator Principal · 1,690 posts #24

install code updated, please use the lastes install codes for better perfomance, you can also login to your publisher account to grab the latest install code.

<?php
  function get_2wap_ads($ads_number = 1, $use_array = true)
    {
      // PHP Install Code Version: 28.3.2010 v 1.03.00 BETA
      // Unique id code of your site
      $site_code = '%site_code%';
      // Enable image ads (true = enable ; false = disable )
      $image_ads = true;
      // Enable adult ads (true = enable ; false = disable )
      $adult_ads = true;
      /* Enable free ads (true = enable ; false = disable ) you will get points instead of Money for this ads which you can use to advertise your site, if this ads are disabled your site will show only cash ads */
      $free_ads = true;
      
      $request_method = 1; /* You can chose here the request method for ads, but the best value is 1 which stands for curl request method. Any other value will be readfile which is not recomended. */
      
      // Do not edit from this line
      
       $IP = ""; if (isset($_SERVER)) { if (isset($_SERVER["HTTP_X_FORWARDED_FOR"])) { $IP = $_SERVER["HTTP_X_FORWARDED_FOR"]; $proxy = $_SERVER["REMOTE_ADDR"]; } elseif (isset($_SERVER["HTTP_CLIENT_IP"])) { $IP = $_SERVER["HTTP_CLIENT_IP"]; } elseif (isset($_SERVER["HTTP_X_REAL_IP"])) { $IP = $_SERVER["HTTP_X_REAL_IP"]; } else { $IP = $_SERVER["REMOTE_ADDR"]; } } else { if (getenv('HTTP_X_FORWARDED_FOR')) { $IP = getenv('HTTP_X_FORWARDED_FOR'); $proxy = getenv('REMOTE_ADDR'); } elseif (getenv('HTTP_CLIENT_IP')) { $IP = getenv('HTTP_CLIENT_IP'); } else { $IP = getenv('REMOTE_ADDR'); } } if (strstr($IP, ',')) { $ips = explode(',', $IP); $IP = $ips[0]; } if (empty($IP)) $IP = $_SERVER["REMOTE_ADDR"]; elseif (strtolower(trim($IP)) == 'unknown') $IP = $_SERVER["REMOTE_ADDR"]; $keyname_ua_arr = array('HTTP_X_DEVICE_USER_AGENT', 'HTTP_X_OPERAMINI_PHONE_UA', 'HTTP_USER_AGENT'); foreach ($keyname_ua_arr as $keyname_ua) { if (!empty($_SERVER[$keyname_ua])) { $ua = urlencode($_SERVER[$keyname_ua]); break; } } $url = 'http://ads.2wap.org/ad.php?site_code='.$site_code.'&ip='.urlencode($IP).'&ua='.$ua.'&uri='.urlencode($_SERVER["REQUEST_URI"]).'&host='.urlencode($_SERVER["HTTP_HOST"]).'&lang='.urlencode($_SERVER["HTTP_ACCEPT_LANGUAGE"]).'&adult='.$adult_ads.'&free='.$free_ads.'&image='.$image_ads.'&ads='.$ads_number.'&code=28-3-10';
       
       if($request_method == 1)
       {
        $request = curl_init(); 
        $request_timeout = 1; // 1 second timeout 
        curl_setopt($request, CURLOPT_URL, $url); 
        curl_setopt($request, CURLOPT_RETURNTRANSFER, 1); 
        curl_setopt($request, CURLOPT_TIMEOUT, $request_timeout); 
        curl_setopt($request, CURLOPT_CONNECTTIMEOUT, $request_timeout); 
        curl_setopt($request, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); 
        $result = curl_exec($request); 
        curl_close($request);
       } 
       else
       {
          if (@$file = fopen($url, "r")) {
               while(!feof($file)) {
                 $result .= fgets($file, 1024);
               }
               fclose ($file);
           }       
       }
       
       
       
      if ($use_array == true && $ads_number > 1)
        {
          $arr = explode("\n", $result);
          $ads = array();
          for($i=0;$i<$ads_number;$i++)
          {
              if(preg_match('/^\<.*\>$/', $arr[$i])) $ads[] = $arr[$i];
          }
          if(count($ads)>0)return $ads;
        }
      elseif(preg_match('/^\<.*\>$/', $result)) 
          return $result;
    }
  // USAGE EXAMPLE
  echo get_2wap_ads();
    /* to show one ad change the number to 2 to show 2 ads */
  /* Or if you want to use 2 ads request and place ads separate on your site use this example: */
  $_2wap_ads = get_2wap_ads(2);
  $first_2wap_ad = $_2wap_ads[0];
  $second_2wap_ad = $_2wap_ads[1];
  /* And now to place the first and second ad eg. at the top and at the bottom of your site put. */
  // top of the site
  echo $first_2wap_ad;
  /*
   Here is your site content
   */
  // bottom of your site
  echo $second_2wap_ad;
  /* this example will save your server ressources because you will get 2 ads at 1 request and also you can put them at different places on your site */
?>

Advertise your mobile site for FREE with AdTwirl

External image (may be gone)

Write your reply now; next you create a free account (or sign in) and it is posted right away. Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close