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]

Reply via email to