Getting an error when trying to pull ads.

Discussion in 'Co-op Advertising Network' started by jfontestad, Mar 30, 2005.

  1. #1
    I'm getting this error while trying to pull ads.:
    Warning: file_get_contents(http://ads.digitalpoint.com/network.php?b=www.*.com&type=link): failed to open stream: Connection refused in /*/*/*/*/httpdocs/ad_network.php on line 40
    | | | |
    I switched from the CGI version to start using the latest PHP version because the CGI version as mentioned in another thread obviously is having cache-ing problems therefor banning my IP every few days. The CGI version worked fine as I could get ads and what not, but I just switched to this version and I'm getting this error.
    Any ideas?
     
    jfontestad, Mar 30, 2005 IP
  2. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,334
    Likes Received:
    2,613
    Best Answers:
    462
    Trophy Points:
    710
    Digital Goods:
    29
    #2
    Maybe your IP is blocked... not sure.
     
    digitalpoint, Mar 30, 2005 IP
  3. jfontestad

    jfontestad Well-Known Member

    Messages:
    1,236
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    148
    #3
    Here's the IP..65.98.60.194
    can you check ?
    If it's blocked I have a few other IPs that may be blocked as well. :| again.....
    I'm moving away from using the CGI version as it has obvious problems, now i'm implemeting the php version for my websites.
     
    jfontestad, Mar 30, 2005 IP
  4. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,334
    Likes Received:
    2,613
    Best Answers:
    462
    Trophy Points:
    710
    Digital Goods:
    29
    #4
    Yeah, it was blocked.
     
    digitalpoint, Mar 30, 2005 IP
  5. jfontestad

    jfontestad Well-Known Member

    Messages:
    1,236
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    148
    #5
    Can you unblock it ?
    I'm still getting the same error.
     
    jfontestad, Mar 30, 2005 IP
  6. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,334
    Likes Received:
    2,613
    Best Answers:
    462
    Trophy Points:
    710
    Digital Goods:
    29
    #6
    Already did.
     
    digitalpoint, Mar 30, 2005 IP
  7. chachi

    chachi The other Jason

    Messages:
    1,600
    Likes Received:
    57
    Best Answers:
    0
    Trophy Points:
    0
    #7
    jfontestad, were you using the cgi wrapper or the old cgi version?
     
    chachi, Mar 30, 2005 IP
  8. jfontestad

    jfontestad Well-Known Member

    Messages:
    1,236
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    148
    #8
    I was using the old cgi version.
    Now I'm just updating to the PHP version.
    It would be nice if an updated CGI version would be relased. ;)

    Has the IP been unblocked yet?
     
    jfontestad, Mar 30, 2005 IP
  9. Cyber-SEO

    Cyber-SEO Member

    Messages:
    68
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    43
    #9
    Looks like he said that he already did!!
     
    Cyber-SEO, Mar 30, 2005 IP
  10. chachi

    chachi The other Jason

    Messages:
    1,600
    Likes Received:
    57
    Best Answers:
    0
    Trophy Points:
    0
    #10
    huh?

    CyberSEO, Shawn is talking about unblocking his IP. I am asking which version of the cgi implementation he used...there are two.

    There is a wrapper version of the cgi that uses the PHP version as well. Was curious which you were using and when you ran into problems.
     
    chachi, Mar 30, 2005 IP
  11. jfontestad

    jfontestad Well-Known Member

    Messages:
    1,236
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    148
    #11
    I believe it was your version chachi. I wasn't using the wrapper version. I started running into problems over the past few weeks.

    ======================================================

    I'm still getting this error shawn...
    'Warning: file_get_contents(http://ads.digitalpoint.com/network.php?b=www.*.com&type=link): failed to open stream: Connection refused in /home/httpd/vhosts/snapbug.com/httpdocs/ad_network.php on line 40'
     
    jfontestad, Mar 30, 2005 IP
  12. jfontestad

    jfontestad Well-Known Member

    Messages:
    1,236
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    148
    #12
    sorry to bump this thread, but any ideas on why this may be happening?

    also I have ads showing here: http:// ps2-world.us , but when I validate says ads not found on http:// ps2-world.us . I clicked the button probably like 10 times and still nothing.
     
    jfontestad, Mar 31, 2005 IP
  13. jfontestad

    jfontestad Well-Known Member

    Messages:
    1,236
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    148
    #13
    @DP:

    Can you check and see if this IP is banned?
    67.15.56.36
    I just switched to the PHP version *updated one* from the CGI version and I'm not receiving any ads so I'm guessing that it's blocked.
     
    jfontestad, Mar 31, 2005 IP
  14. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,334
    Likes Received:
    2,613
    Best Answers:
    462
    Trophy Points:
    710
    Digital Goods:
    29
    #14
    Yeah, it was blocked (not now). Update to the new PHP (came out today), while you are at it.
     
    digitalpoint, Mar 31, 2005 IP
  15. jfontestad

    jfontestad Well-Known Member

    Messages:
    1,236
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    148
    #15
    One question.
    I already have the ads being called from another script called coop.php that way I just included it into all of my pages 'include virtual=coop.php' blah blah... but I'm getting this turnout when using the new updated file.
    "Array"

    this is what I have in my coop.php file:
    <?php 
        include ('ad_network.php'); 
        echo $ad_network; 
    ?>
    Code (markup):
    Any suggestions?
     
    jfontestad, Mar 31, 2005 IP
  16. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,334
    Likes Received:
    2,613
    Best Answers:
    462
    Trophy Points:
    710
    Digital Goods:
    29
    #16
    You sure you updated that file? That's what you would get if you didn't.
     
    digitalpoint, Mar 31, 2005 IP
  17. jfontestad

    jfontestad Well-Known Member

    Messages:
    1,236
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    148
    #17
    I'm pretty sure.
    This is the file i'm using:

    <?php
    	// Last update:  Feb 22, 2005 2:18 pm
    
    	if (!function_exists('file_get_contents')) {
    		function file_get_contents($url) {
    			$handle = fopen($url, 'r');
    			$string = fread($handle, 4096000);
    			fclose($handle);
    			return $string;
    		}
    	}
    	
    	if (!function_exists('make_seed')) {
    		function make_seed() {
    			list($usec, $sec) = explode(' ', microtime());
    			return (float) $sec + ((float) $usec * 100000);
    		}
    		mt_srand (make_seed());
    	}
    
    	if (!isset($_SERVER)) $_SERVER = $HTTP_SERVER_VARS;
    
    	$ad_file = 'ad_network_ads.txt';
    	for ($i = 0; $i <= 11; $i++) {
    		$p = substr ('../../../../../../../../../../', 0, $i * 3);
    		if (file_exists ($p . $ad_file)) {
    			$ad_file = $p . $ad_file;
    			break;
    		}
    	}
    
    	if (is_writable ($ad_file)) {
    		$ads = file_get_contents ($ad_file);
    		$ads = explode ('<ad_break>', $ads);
    		$ads_temp = explode ('|', $ads[0]);
    
    		$file = fopen($ad_file, 'r+');
    		if (flock ($file, LOCK_EX|LOCK_NB, $would_block) && !$would_block) {
    			if ((count ($ads) < $ads_temp[3] + 1 && $ads_temp[0] + $ads_temp[5] < time()) || $ads_temp[0] + $ads_temp[4] < time()) {
    				$new_ad = file_get_contents ('http://ads.digitalpoint.com/network.php?b=' . $_SERVER['SERVER_NAME'] . '&type=link');
    				if ($new_ad) {
    					$ads_param = explode ('<ad_param>' , $new_ad);
    					$new_ad = $ads_param[1];
    					unset ($ads_param[1]);
    					$ads_temp = explode ('|', $ads_temp[0] . '|' . $ads_temp[1] . '|' . $ads_param[0]);
    				} else {
    					$ads_param = array_slice ($ads_temp, 2, 4);
    				}
    				$ads[0] = time() . '|' . gethostbyname('validate.digitalpoint.com') . '|' . implode ('|', $ads_param);
    				if ($new_ad) {
    					$ads[] = $new_ad;
    					if (count ($ads) > $ads_temp[3] + 1) $ads = array_merge ((array)$ads[0], (array)array_slice ($ads, -$ads_temp[3]));
    				}
    				fwrite ($file, implode ('<ad_break>', $ads));
    				ftruncate ($file, ftell($file));
    				$ad_network[] = $new_ad;
    			}
    			flock ($file, LOCK_UN);
    			fclose ($file);
    		}
    		while (count ($ad_network) < 5) {
    			$ad_network[] = $ads[mt_rand(1,count($ads) - 1)];
    		}
    		foreach ($ad_network as $key => $ad) {
    			if ($ads_temp[1] == $_SERVER['REMOTE_ADDR'] || $_SERVER['SERVER_ADDR'] == $_SERVER['REMOTE_ADDR']) {
    				$ad_network[$key] = str_replace ('" />', '" class="' . $ads_temp[2] . '" />', $ad);
    			} else {
    				$ad_network[$key] = str_replace ('" />', '">', $ad);
    			}
    		}
    	} else {
    		$ad_network[] = 'You must set the ad network .txt file to be writable.';
    	}
    	if (substr (@$_SERVER['DOCUMENT_NAME'], -6) == '.shtml') {
    		ini_set ('zlib.output_compression', 0);
    		echo end ($ad_network);
    	}
    
    ?>
    Code (markup):
     
    jfontestad, Mar 31, 2005 IP
  18. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,334
    Likes Received:
    2,613
    Best Answers:
    462
    Trophy Points:
    710
    Digital Goods:
    29
    #18
    That's the old one (check that update date at the top).
     
    digitalpoint, Mar 31, 2005 IP
  19. jfontestad

    jfontestad Well-Known Member

    Messages:
    1,236
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    148
    #19
    Oh. :\
    hahahaha
    I went in the setup instructions and got it froem there...
    so i thought :\
     
    jfontestad, Mar 31, 2005 IP
  20. jfontestad

    jfontestad Well-Known Member

    Messages:
    1,236
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    148
    #20
    Everything working good.
    I'm still baffled though on why I'm getting this error from one of my websites:
    Warning: file_get_contents(http://ads.digitalpoint.com/network.php?c=*.com&type=link): failed to open stream: Connection refused in /home/httpd/vhosts/*.com/httpdocs/ad_network.php on line 40
    | | | | "

    IP is: 65.98.60.194

    It pulled the ads nicely with the cgi script, don't know why its not doing the same with the php script. :\
     
    jfontestad, Mar 31, 2005 IP