Ads In Php Not Working

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Ads In Php Not Working

    Hi All,

    I am new to this mobile stuff.

    Been searching forums and making phone calls to try to figure out why the direct link php ad script is not being interpreted in my sites.

    The sites are http://sergeantbrettscoffee.mobi and http://mobisize.mobi They are hosted on GoDaddy in a shared hosting account.
    I have used several php mail scripts in my other sites in the same account with no problem.

    Even a simple echo wont't work.

    I've tried putting a .htaccess file in the folder with AddType application/x-httpd-php .htm .html .php and variants, including one with .wml and also with the file extensions without the dots. I keep getting parse errors.

    Please help.

    Regards,
    doktorg

    #2
    what ad service are you using?

    Comment


      #3
      what ad service are you using?[/b]
      We are using admob.

      Comment


        #4
        Code:
        echo &#39;<p align="center">[size="1"]&#39;;
             /* editable area */
          $mob_mode = &#39;live&#39;; // change mode from "test" to "live" when you are done testing
          $mob_alternate_link = &#39;[url]http://lavalair.net&#39;;[/url] // use this to set a default link to appear if AdMob does not return an ad.
            
          /* end editable area */
            
          //used for ad targeting
          $mob_contents = &#39;&#39;;
          $mob_ua = urlencode(getenv("HTTP_USER_AGENT"));
          $mob_ip = urlencode($_SERVER[&#39;REMOTE_ADDR&#39;]);
          
          if ($mob_mode==&#39;test&#39;)
              $mob_m = "&m";
        
          $mob_url = &#39;[url]http://ads.admob.com/ad_source.php?s=SITE[/url] ID HERE&u=&#39;.$mob_ua.&#39;&i=&#39;.$mob_ip.$mob_m;
        
          @$mob_ad_serve = fopen($mob_url,&#39;r&#39;);
            
          if ($mob_ad_serve) {
              while (!feof($mob_ad_serve))
                  $mob_contents .= fread($mob_ad_serve,1024);
              fclose($mob_ad_serve);
          }
          $mob_link = explode("><",$mob_contents);
        
          $mob_ad_text = $mob_link[0];
          $mob_ad_link = $mob_link[1];
        
          if (isset($mob_ad_link) && ($mob_ad_link !=&#39;&#39;)) {
              //display AdMob Ad
              echo &#39;[url="&#39;. $mob_ad_link .&#39;"]&#39;. $mob_ad_text . &#39;[/url]&#39;;
          }
          else {
              //no AdMob ad, display alternate
              echo $mob_alternate_link;
          }
         echo &#39;[/size]</p>&#39;;
            $ret = "\n</card>\n</wml>";
            return $ret;
        }
        function xhtml_footer()
        {    
            echo &#39;<h3 align="center">[size="1"]&#39;;
             /* editable area */
          $mob_mode = &#39;live&#39;; // change mode from "test" to "live" when you are done testing
          $mob_alternate_link = &#39;[url]http://lavalair.net&#39;;[/url] // use this to set a default link to appear if AdMob does not return an ad.
            
          /* end editable area */
            
          //used for ad targeting
          $mob_contents = &#39;&#39;;
          $mob_ua = urlencode(getenv("HTTP_USER_AGENT"));
          $mob_ip = urlencode($_SERVER[&#39;REMOTE_ADDR&#39;]);
          
          if ($mob_mode==&#39;test&#39;)
              $mob_m = "&m";
        
          $mob_url = &#39;[url]http://ads.admob.com/ad_source.php?s=SITE[/url] ID HERE&u=&#39;.$mob_ua.&#39;&i=&#39;.$mob_ip.$mob_m;
        
          @$mob_ad_serve = fopen($mob_url,&#39;r&#39;);
            
          if ($mob_ad_serve) {
              while (!feof($mob_ad_serve))
                  $mob_contents .= fread($mob_ad_serve,1024);
              fclose($mob_ad_serve);
          }
          $mob_link = explode("><",$mob_contents);
        
          $mob_ad_text = $mob_link[0];
          $mob_ad_link = $mob_link[1];
        
          if (isset($mob_ad_link) && ($mob_ad_link !=&#39;&#39;)) {
              //display AdMob Ad
              echo &#39;[url="&#39;. $mob_ad_link .&#39;"]&#39;. $mob_ad_text . &#39;[/url]&#39;;
          }
          else {
              //no AdMob ad, display alternate
              echo $mob_alternate_link;
          }
         echo &#39;[/size]</h3>&#39;;
            $ret = "\n</body>\n</html>";
            return $ret;
        }
        function xhtml_header($page_title, $page_style="")
        {
        thats my admob code think its the same just make sure its right on your scripts, also you have your correct site id in the $mob_url = &#39;http://ads.admob.com/ad_source.php?s=SITE ID HERE&u=&#39;.$mob_ua.&#39;&i=&#39;.$mob_ip.$mob_m; bits and also that your ads are in live mode and not test

        Comment


          #5
          Code:
          echo &#39;<p align="center">[size="1"]&#39;;
               /* editable area */
            $mob_mode = &#39;live&#39;; // change mode from "test" to "live" when you are done testing
            $mob_alternate_link = &#39;[url]http://lavalair.net&#39;;[/url] // use this to set a default link to appear if AdMob does not return an ad.
              
            /* end editable area */
              
            //used for ad targeting
            $mob_contents = &#39;&#39;;
            $mob_ua = urlencode(getenv("HTTP_USER_AGENT"));
            $mob_ip = urlencode($_SERVER[&#39;REMOTE_ADDR&#39;]);
            
            if ($mob_mode==&#39;test&#39;)
                $mob_m = "&m";
          
            $mob_url = &#39;[url]http://ads.admob.com/ad_source.php?s=SITE[/url] ID HERE&u=&#39;.$mob_ua.&#39;&i=&#39;.$mob_ip.$mob_m;
          
            @$mob_ad_serve = fopen($mob_url,&#39;r&#39;);
              
            if ($mob_ad_serve) {
                while (!feof($mob_ad_serve))
                    $mob_contents .= fread($mob_ad_serve,1024);
                fclose($mob_ad_serve);
            }
            $mob_link = explode("><",$mob_contents);
          
            $mob_ad_text = $mob_link[0];
            $mob_ad_link = $mob_link[1];
          
            if (isset($mob_ad_link) && ($mob_ad_link !=&#39;&#39;)) {
                //display AdMob Ad
                echo &#39;[url="&#39;. $mob_ad_link .&#39;"]&#39;. $mob_ad_text . &#39;[/url]&#39;;
            }
            else {
                //no AdMob ad, display alternate
                echo $mob_alternate_link;
            }
           echo &#39;[/size]</p>&#39;;
              $ret = "\n</card>\n</wml>";
              return $ret;
          }
          function xhtml_footer()
          {    
              echo &#39;<h3 align="center">[size="1"]&#39;;
               /* editable area */
            $mob_mode = &#39;live&#39;; // change mode from "test" to "live" when you are done testing
            $mob_alternate_link = &#39;[url]http://lavalair.net&#39;;[/url] // use this to set a default link to appear if AdMob does not return an ad.
              
            /* end editable area */
              
            //used for ad targeting
            $mob_contents = &#39;&#39;;
            $mob_ua = urlencode(getenv("HTTP_USER_AGENT"));
            $mob_ip = urlencode($_SERVER[&#39;REMOTE_ADDR&#39;]);
            
            if ($mob_mode==&#39;test&#39;)
                $mob_m = "&m";
          
            $mob_url = &#39;[url]http://ads.admob.com/ad_source.php?s=SITE[/url] ID HERE&u=&#39;.$mob_ua.&#39;&i=&#39;.$mob_ip.$mob_m;
          
            @$mob_ad_serve = fopen($mob_url,&#39;r&#39;);
              
            if ($mob_ad_serve) {
                while (!feof($mob_ad_serve))
                    $mob_contents .= fread($mob_ad_serve,1024);
                fclose($mob_ad_serve);
            }
            $mob_link = explode("><",$mob_contents);
          
            $mob_ad_text = $mob_link[0];
            $mob_ad_link = $mob_link[1];
          
            if (isset($mob_ad_link) && ($mob_ad_link !=&#39;&#39;)) {
                //display AdMob Ad
                echo &#39;[url="&#39;. $mob_ad_link .&#39;"]&#39;. $mob_ad_text . &#39;[/url]&#39;;
            }
            else {
                //no AdMob ad, display alternate
                echo $mob_alternate_link;
            }
           echo &#39;[/size]</h3>&#39;;
              $ret = "\n</body>\n</html>";
              return $ret;
          }
          function xhtml_header($page_title, $page_style="")
          {
          thats my admob code think its the same just make sure its right on your scripts, also you have your correct site id in the $mob_url = &#39;http://ads.admob.com/ad_source.php?s=SITE ID HERE&u=&#39;.$mob_ua.&#39;&i=&#39;.$mob_ip.$mob_m; bits and also that your ads are in live mode and not test

          Comment


            #6
            amylee,

            Many thanks. When I saw the echo at the top of your script, it led me in the right direction. I converted all the pages into php, did some cleaning up, and voila, it all worked.

            doctorg

            Comment


              #7
              anytime

              Comment


                #8
                do we have to edit the admob add code somewhere? i have noticed that time to time my site gives errors. i used the admob php curl code and made a php file in included in on my page is there something wrong?
                Failure is not when a girls leaves you, its only when you let her go virgin. heheh!!

                <span style="color:#9ACD32"><span style="font-size:36pt;line-height:100%">BEST MOBILE ADVERTISER</span></span>

                Comment


                  #9
                  do we have to edit the admob add code somewhere? i have noticed that time to time my site gives errors. i used the admob php curl code and made a php file in included in on my page is there something wrong? [/b]
                  time to time your site gives errors,because you mess up the codes,files etc.
                  change $mob_mode = &#39;live&#39;;
                  add here your SITE ID
                  $mob_url = &#39;http://ads.admob.com/ad_source.php?s=SITE ID
                  include the .php file like include("ad.php");
                  and to test if you admob account get live ads,check by using the echo" <a href="...........</a>; link

                  Comment


                    #10
                    im not even being able to see my adds on the phone from pc i see them but not on my phone
                    Failure is not when a girls leaves you, its only when you let her go virgin. heheh!!

                    <span style="color:#9ACD32"><span style="font-size:36pt;line-height:100%">BEST MOBILE ADVERTISER</span></span>

                    Comment

                    Working...
                    X