n1concepts Posted April 10, 2013 Share Posted April 10, 2013 Hi, Does anyone have a solution or have had to implement a PHP setup where you fire iframe pixels from your script based on conversions from an external page. FYI: the script where the iframe code will be loaded is not rendered by a viewer - it's a secured php script within the application that pulls the select iframe from database and print to screen within a loop/array. For example: External link: http://domain1.com/index.php?leadid=123 Where: $leadid is the tracking value to know where lead originated from to load correct pixel $c=track1 // this is conversion value assigned that will fire on iframe pixel (below) iframe pixel for #123: <iFrame scr="http://www.domain.com/pixel.php?p=$c" ></iFrame> Therefore, the snippet of code would look like: <?php $c = track1; // this is the value that will identify the campaign where conversion assigned $pixel = " <iFrame scr="http://www.domain.com/pixel.php?p="; // building the iframe pixel $pixel .= "$c\" ></iFrame>"; // appending variable $c and completing the iframe if ($_GET[leadid] == 123) { echo pixel; // fire or pring the iframe to the php page ?> Note: the domain (URL) is not real - just used to demo the setup. Now, here's the issue: that snippet of code will work if I load to php page via traditional web browser methods (calling in Firefor, IE, etc...) However, that's not how the setup is defined: Setup: 1. external offer will fire the pixel back to me (say at site: http://tracking.com) and once I have their return data - via $_GET function (pulling values from url), I then implement the above code to alert the specified publish who is awarded the lead. This is where the problem arise.... Issue: b/c the application receives hundreds (at a minimum) per hundred, there is no simple way to load each individual iframe - in the php page and render it - so it fires correctly. Note: I've already tried creating a loop to parse the database - that captures the data and via sql query, I can fire each (loading them individually). Problem: that query parses through each so fast (within seconds), there is not enough time for any one set of pixels to fire the select iframe. ----------- This is where I need some feedback on how to accomplish this to support objective from an application perspective - having to load multiple pixels (each different based on where lead data logged to database). Again, how can I successfully load each iframe (as they logged to database) to fire, being there is no 'public' page being viewed? There's only the php script processing the lead and parsing the iframe - echoing it but only showing for less than one second. I know there's a solution but just having pin pointed it yet.... Quote Link to comment Share on other sites More sharing options...
n1concepts Posted April 10, 2013 Author Share Posted April 10, 2013 What I'm asking to understand is, 'is there a way to create and load a 'temp' php page that house that select iframe code'? I know this possible to create a file, etc.. but wanting to know if there is a more efficient way to handle this operation b/c that will then create thousands of pages (hourly) which is a waste of disk space. Hopefully, I've given enough details to provide a visual for a true response - I know some will give 'corky' answers (no worries) but looking for some creditable input (thx!) Quote Link to comment Share on other sites More sharing options...
n1concepts Posted April 10, 2013 Author Share Posted April 10, 2013 Still welcome answers / responses but I think I found my answer: http://php.net/manual/en/function.flush.php I need to flush the output to apache and set sleep time just long enough to let pixel (content) load ot page, then I can continue looping through script - serving remaining pixels waiting to fire. Quote Link to comment Share on other sites More sharing options...
lemmin Posted April 10, 2013 Share Posted April 10, 2013 I don't fully understand your question, but it seems like there should be an easier way to do this. Could you be more specific as to the flow of the requests to and from your server. Where in that flow is the issue? Are you trying to parse content from an HTTP request? Quote Link to comment Share on other sites More sharing options...
Solution n1concepts Posted April 11, 2013 Author Solution Share Posted April 11, 2013 Hi, There is - no need to create 'repeative' files, etc... The answer lies in this link: http://php.net/manua...ction.flush.php baically, I just need to pass code (the iframe) to the buffer in apache and give an 1/2 sec to display then resume script - looping through rest of array. Problem solved and it works - thx! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.