Ken--

There's no "secret code".  By "giving" the response, I mean the
MovieResponder.php outputs that data... This is the most elementary of
PHP features... See:

http://www.php.net/manual/en/function.echo.php
http://www.php.net/manual/en/function.print.php

By "giving" the data to your script, I am saying that the
MovieResponder.php script outputs the data (see above) thinking that a
-web browser- is at the other end... Your script takes that data, and
stores it to a variable by calling fread() (which I explained before).

You may want to start from the beginning, and get a good grasp as how
exactly the PHP language works:

http://www.php.net/manual/en/langref.php

Then experiment!  Create a PHP script that reads the data from a URL,
for example:

<?php

$url = fopen("http://snaps.php.net/";, "r");
$page = fread($url, 10240);
fclose($url);

echo $page;

?>

The $page variable will contain the output of http://snaps.php.net/.

Good luck!
--Matt


-----Original Message-----
From: Ken Sommers [mailto:[EMAIL PROTECTED]] 
Sent: Monday, July 16, 2001 4:50 PM
To: Matthew Loff; 'PHP DB Mailing List'
Subject: Re: [PHP-DB] the body of the response


MR.Loff,
I see the concept.. but i still don;t see the secret code.
for this process:

And you created MovieResponder.php to give you this response:

Movie One 1977
Movie Two 1977
Movie Three 1977

how does it GIVE????..is there a php function called GIVE()? where does
the Give() function Give it's data?

does it have to give in here?

<body> <? php Give() ?> </body>

what gives?


what is the secret code?
I looked up Give()  in the php manual..no such function.as give().

what is the secret code?

---
MovieResponder.php can generate -anything- you want... HTML code, a
serialize()d array, or anything else...

suppose I Need MovieResponder.php to generate  an  array..
how do I "generate" it ?
what does "generate" mean in PHP?

does it mean an assignment statement? does an assignment statement
GENERATE an array? or maybe an Echo statement to the <body> GENERATEs an
array? what is the secret code Generate() is not a valid php function
either.

what is the secret code,?,and why is it secret?

Ken






Ken




----- Original Message -----
From: "Matthew Loff" <[EMAIL PROTECTED]>
To: "'Ken Sommers'" <[EMAIL PROTECTED]>; "'PHP DB Mailing
List'" <[EMAIL PROTECTED]>
Sent: Monday, July 16, 2001 1:34 PM
Subject: RE: [PHP-DB] the body of the response


>
> MovieResponder.php can generate -anything- you want... HTML code, a 
> serialize()d array, or anything else...
>
> By using fopen() to call http://www.wherever.com/MovieResponder.php 
> and
> fread() to grab the data to a local variable, you're calling the
> MovieResponder.php script as if you are simply accessing it through a
> web browser!
>
> Whatever MovieResponder.php outputs-- HTML, etc... Will be saved in 
> your local variable for manipulation!
>
>
> Here's an example... Say your MovieResponder.php file takes the $actor

> and $year variables, and queries MySQL, then returns a list of movies.
>
> ... Let's say you called your script through your web browser as 
> http://www.wherever.com/MovieResponder.php?actor=Somebody&year=1977
> And you created MovieResponder.php to give you this response:
>
> Movie One 1977
> Movie Two 1977
> Movie Three 1977
>
> ... If your local PHP script looks like this:
>
> $file = fopen("http://www.wherever.com/MovieResponder.php?actor="; .
> urlencode($actor) . "&year=" . urlencode($year), "r");
> $data = fread($file, 10240);
> fclose($file);
>
> ... Then if you called your local script with $actor = Somebody and 
> $year = 1977, when it is called, your $data variable would contain:
>
> Movie One 1977
> Movie Two 1977
> Movie Three 1977
>
> Easy as that!  It's a very simple concept.
>
>
> -----Original Message-----
> From: Ken Sommers [mailto:[EMAIL PROTECTED]]
> Sent: Monday, July 16, 2001 4:04 PM
> To: Matthew Loff; 'PHP DB Mailing List'
> Subject: Re: [PHP-DB] the body of the response
>
>
> thanks for response,
>
> I am curious, how does the http://www.site.com/MovieResponder.php 
> script get the data in the body?. what is the mechanism involved? is 
> this "body" the <body> </php echo $data;<?> </body>
>
> of an html page?
>
> is this the "body we are talking about or some other body?
>
>
> what is the secret code involved?
> thanks again,
>
> Ken
>
> ----- Original Message -----
> From: "Matthew Loff" <[EMAIL PROTECTED]>
> To: "'Ken Sommers'" <[EMAIL PROTECTED]>; "'PHP DB Mailing 
> List'" <[EMAIL PROTECTED]>
> Sent: Monday, July 16, 2001 12:53 PM
> Subject: RE: [PHP-DB] the body of the response
>
>
> >
> >
> > The "body" of the response is the data that the 
> > http://www.site.com/MovieResponder.php script would produce.
> >
> > The fread() call that I meantioned before would read -all- of this 
> > data into a variable.
> >
> >
> > -----Original Message-----
> > From: Ken Sommers [mailto:[EMAIL PROTECTED]]
> > Sent: Monday, July 16, 2001 11:52 AM
> > To: PHP DB Mailing List
> > Subject: [PHP-DB] the body of the response
> >
> >
> > PHP manual says:
> > fopen
> > fopen -- Opens file or URL
> > Description
> > int fopen (string filename, string mode [, int use_include_path])
> >
> > If filename begins with "http://"; (not case sensitive), an HTTP 1.0 
> > connection is opened to the specified server, the page is requested 
> > using the HTTP GET method, and a file pointer is returned to the 
> > beginning of the body of the response.
> > --------
> > can someone explain the clause:
> >
> > "and a file pointer is returned to the beginning of the body of the 
> > response."
> >
> > can someone explain and describe what this "body"  is?
> >
> > can query results be put in this 'body',,if so how?
> >
> > thanks,
> >
> > Ken
> >
> >
> > --
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED] For 
> > additional commands, e-mail: [EMAIL PROTECTED] To contact 
> > the list administrators, e-mail: [EMAIL PROTECTED]
> >
>


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to