Perad Posted March 11, 2008 Share Posted March 11, 2008 I have the following task. Allow users to put code on their website which will show a poll. What I need the script to do is the following... -> Sit on the users homepage. -> Connect to my server and request poll details -> When form is submitted send option to my form, request poll results. -> Show poll results. I am thinking about using iframes. <iframe src="http://site.com/poll.php?id=..."></iframe> Now, would this work with iframes? Whether it would or not does anyone know a better method which isn't iframe dependent? Quote Link to comment https://forums.phpfreaks.com/topic/95611-a-php-plugin/ Share on other sites More sharing options...
uniflare Posted March 11, 2008 Share Posted March 11, 2008 if you have a quality server im sure you could use sockets or url fopen() or similar to get all the information from a remote server. eg on remote server have page called "poll_deails.php" then use something similar to fopen("http://www.webserver.com/poll_details.php?detailsfor=thiswebsite"); then you would get a string you could explode into an array for all the seperate variables etc... you could also add in poll_details.php: if($_SERVER['REMOTE_ADDR'] != "website_ip_address"){ exit("Not Allowed"); } hope this helps, Quote Link to comment https://forums.phpfreaks.com/topic/95611-a-php-plugin/#findComment-489461 Share on other sites More sharing options...
Perad Posted March 11, 2008 Author Share Posted March 11, 2008 The problem is that the remote server may not support php and this needs to work on all servers whether they support php or not. Thats why I was thinking about iframes. Quote Link to comment https://forums.phpfreaks.com/topic/95611-a-php-plugin/#findComment-489464 Share on other sites More sharing options...
MadTechie Posted March 11, 2008 Share Posted March 11, 2008 what about create an Dynamic Image to show the results <?php $row['votes'] = 0; //mysql stuff returns $row['votes'] $im = imagecreatetruecolor(150, 30); $bgc = imagecolorallocate($im, 255, 255, 255); $tc = imagecolorallocate($im, 0, 0, 0); imagefilledrectangle($im, 0, 0, 150, 30, $bgc); imagestring($im, 1, 5, 5, "the votes are .{$row['votes']}.. ", $tc); header("Content-Type: image/jpeg"); imagejpeg($im); ?> <img src="www.mysite.com/votes.php"> of course your need to clean it up... Quote Link to comment https://forums.phpfreaks.com/topic/95611-a-php-plugin/#findComment-489468 Share on other sites More sharing options...
uniflare Posted March 11, 2008 Share Posted March 11, 2008 my method does not mention that php is required on a remote server, it was just an example, you could easily use html/asp etc, or even flat files or exe's... how is your remote server going to "feed" the information sp that your website can grab it? Quote Link to comment https://forums.phpfreaks.com/topic/95611-a-php-plugin/#findComment-489469 Share on other sites More sharing options...
uniflare Posted March 11, 2008 Share Posted March 11, 2008 ok i misunderstood your post... so you could use images as madtechie posted, you could use iframes as you suggested. the image route can also be cached to prevent people from spamming images. images would be my first option.... Quote Link to comment https://forums.phpfreaks.com/topic/95611-a-php-plugin/#findComment-489475 Share on other sites More sharing options...
MadTechie Posted March 11, 2008 Share Posted March 11, 2008 of course passing a parameter to it would be the same as a get and allowing a vote via click would probably just be a hyperlink Quote Link to comment https://forums.phpfreaks.com/topic/95611-a-php-plugin/#findComment-489491 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.