Re: calling a php script using img src ="random.php"




Tex John wrote:
> "Dahak" <Dahak_II@xxxxxxxxxxxxxxxxxxxx> wrote in message
> news:pf8051td36s9ia5eqbl1c1bsgsj81iev74@xxxxxxxxxx
> > On Thu, 17 Mar 2005 00:02:16 +0100, an orbiting mind-control laser
> > made "Alvaro G. Vicario" <kAlvaroNOSPAMTHANKS@xxxxxxxx> write:
> >
> > >*** bhennon@xxxxxxxxx escribió/wrote (16 Mar 2005 13:33:26
-0800):
> > >> http://www.2006ymcanationals.com/random.php
> > >>
> > >> IT WORKS IF I go directly to the above link.
> > >>
> > >> I am trying to call that in another page so that i get a random
image
> > >> the page is http://2006ymcanationals.com/index.php using <img
> > >> src="random.php">
> > >
> > >Your script does not return an image. It returns an HTML page that
links
> to
> > >an image. You cannot link to an HTML page with the <img> tag.
Maybe
> you're
> > >thinking of <iframe>?
> > >
> > >You could either choose a random filename:
> > >
> > ><img src="<?=get_random_img_name()?>">
> > >
> > >Or make your script return an actual image:
> > >
>
>
> Here's a working example that might help. This checks to see if a
website is
> up and if it is, it displays a smiley gif and if not, a not so smiley
gif in
> a table of smileys. Now the page doesn't wait for ALL the smileys to
not
> time out before displaying; rather it displays the whole table
immediately
> and these pop up as they finish running. Now if it would only display
a
> "processing" gif while we waited :>)
>
> ==== An Actual Table Row ======
>
> <tr>
> <td>Logon.net</td>
> <th><img src="/frag/status.php?addr=www.logon.net" width="37"
> height="20"></th>
> <th><img src="/frag/status.php?addr=mail.logon.net&port=25"
width="37"
> height="20"></th>
> <th><img src="/frag/status.php?addr=mail.logon.net&port=110"
width="37"
> height="20"></th>
> <th><img src="/frag/status.php?addr=mail.logon.net" width="37"
> height="20"></th>
> <th>&nbsp;</th>
> </tr>
>
> ==== status.php has to be above Doc Root ===============
>
> <?php
> //Web Server Status v 1.2, Copyright 2002 By Ryan Schwiebert, visit
> http://www.schwebdesigns.com/
> //This script may be freely distributed providing all copyright
headers are
> kept intact.
>
> //Concept from:
> //Abax Server Status v1.04, Copyright 2002 By Nathan Dickman, visit
> http://www.NathanDickman.com/
> //Location of the live or dead server images
>
> // Updated by John Jarrett 2003
>
> //Please change to your server specifications
> $live = "/frag/images/live2.gif";
> $dead = "/frag/images/dead2.gif";
>
> //The status checking script
> //meddle at your own risk!
> //check for port number, default is 80
> #list($addr,$port)= explode (':',"$link");
> if (empty($port)) {
> $port = 80;
> }
>
> //Test the server connection
>
> $churl = @fsockopen(server($addr), $port, $errno, $errstr, 20);
> #$churl = @fsockopen($addr, $port, $errno, $errstr, 20);
> if (!$churl){
> header("Location: $dead");
> }
> else {
> header("Location: $live");
> }
> function server($addr){
> if(strstr($addr,"/")){$addr = substr($addr, 0, strpos($addr,
> "/"));}
> return $addr;
> }
> ?>
>
> ====== end of script =====
>
> hth,
> John


I was never able to get this working. Some people say you cannot call a
php script that outputs html from within an html page and others say
that it works. Which is it? Looks like it works in Johns example.

John,
could you post the rest of the html from your example? Is the page
named index.php or index.html?

Is there an opening and closing php statement in the page somewhere?
"<?php" and "?>"

Thanks for your help.
Brad

.



Relevant Pages

  • Re: [wwwsearch-general] (no subject)
    ... On Fri, 29 Aug 2008, bruce wrote: ... I haven't tried to understand your script or the HTML, ... John ...
    (comp.lang.python)
  • Cant make this page work
    ... I can't make this script work properly. ... The script at the bottom of the html page ... Does someone have a perl ... sub output_trace_headers { ...
    (comp.lang.javascript)
  • Re: Roadshows, Part V
    ... each of the "skits" with John and Miles, there was a part where Miles ... script with cues for the lights and sound folks. ... "Listen, you know I really dig that Priscilla chick, right?" ...
    (soc.religion.mormon)
  • lk-changelog.pl 0.325
    ... This script is used by Linus and Marcelo to rearrange and reformat BK ... +'christoph:lameter.com' => 'Christoph Lameter', ... 'hawkes:oss.sgi.com' => 'John Hawkes', ... 'lethal:unusual.internal.linux-sh.org' => 'Paul Mundt', ...
    (Linux-Kernel)
  • Re: Use with Action "Send Reply" Dont Go
    ... Set Up an HTML Signature ... Go to Tools/Signatures in Entourage, ... "Auto-Reply HTML" or something similar. ... script in the Entourage Script Menu Items folder. ...
    (microsoft.public.mac.office.entourage)