Displaying .php file in ad server. Something im missing?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
IanB
Forum Newbie
Posts: 2
Joined: Sun Jul 17, 2011 2:31 pm

Displaying .php file in ad server. Something im missing?

Post by IanB »

Hi,

I think im missing something stupid, so please help me out :D

I have a dynamic php script that gets called that generates a 300x250 "widget" of sorts with expanding and collapsing boxes that display a leaderboard for a game thats being played. Now what is required is to take the output of the .php file and run it through an Ad Server and display it to an ad network. The ad network uses AdTech to display on the network, but im trying using OpenX to get it working.

Anyone know of a way that I can do this? I've tried just using that .php as the banner URL but nothing displays, i suspect because its not content type "image/*".?

Thanks in advance, and apologies if this is the wrong forum!

Cheers
Ian
User avatar
Jonah Bron
DevNet Master
Posts: 2764
Joined: Thu Mar 15, 2007 6:28 pm
Location: Redding, California

Re: Displaying .php file in ad server. Something im missing?

Post by Jonah Bron »

Are you sure this ad network allows non-images?
IanB
Forum Newbie
Posts: 2
Joined: Sun Jul 17, 2011 2:31 pm

Re: Displaying .php file in ad server. Something im missing?

Post by IanB »

See this is where i wonder what the limits are and how to get around them. On one hand i say yes, if I wrote an ad server i would never let anyone run a .php as a banner, but surely there must be a way that i could use JavaScript or something to invocate the code and i could give that JavaScript code to the ad server?
User avatar
Jonah Bron
DevNet Master
Posts: 2764
Joined: Thu Mar 15, 2007 6:28 pm
Location: Redding, California

Re: Displaying .php file in ad server. Something im missing?

Post by Jonah Bron »

You need to find out what they allow, and how the platform works. You'll just be guessing until you do.
beetree
Forum Commoner
Posts: 26
Joined: Mon Jul 18, 2011 6:30 pm
Location: Peninsula

Re: Displaying .php file in ad server. Something im missing?

Post by beetree »

If they only allow images you can still do it. You have your PHP script generate an image using GD (http://php.net/manual/en/book.image.php) echo out an image header and link your php script to the ad-network.
smassey
Forum Newbie
Posts: 5
Joined: Wed Jul 20, 2011 4:19 am

Re: Displaying .php file in ad server. Something im missing?

Post by smassey »

There's no problem using dynamicly generated images, I have personnly been involved doing just that on the openx platform.
Be sure to send the right headers HTTP and not to timeout though!

Code: Select all

header('Content-type: image/png'); # jpeg, gif, etc
I would highly recommend you set up some sort of caching solution though, regenerating dym images will take down any server once the QPS starts rising.
smassey
Forum Newbie
Posts: 5
Joined: Wed Jul 20, 2011 4:19 am

Re: Displaying .php file in ad server. Something im missing?

Post by smassey »

Also, be aware of white spaces, a common mistake in generating dyn images! A single trailing whitespace in a .php file is enough to break the encoding! Don't use closing php tags helps avoid this as well as output buffering with the ob_* functions. Good luck
Post Reply