Dave M G wrote:
> PHP List,
> 
> I'm writing a PHP script that has a form which accesses a CGI script on
> an external web site.
> 
> The CGI I am accessing is a Japanese dictionary. My form will take
> Japanese input, send it to the external server, and hopefully return
> with a list of words and definitions. I hope to be able to trap the
> output from the external server in such a way that I can use PHP to
> maniplate the output and structure it for insertion into a database.
> 
> What I have for the <form> tag is:
> 
> echo "<form method=\"uri\"
> action=\"http://www.csse.monash.edu.au/~jwb/cgi-bin/wwwjdic?9MGI\";>";
> 
> The "9MGI" part is syntax specific to the CGI script at monash.edu.au
> that I am accessing. It says to use utf8 encoding, and specifies which
> dictionary to use.
> 
> The method is "uri", so that the text included in the form will be
> appended to the URL.

then the method should be 'get' no?

> 
> When I test my script in my FireFox browser, I get a pop up window
> asking me what to do with a "bin" file. I click to save it, and I get a
> file called "wwwjdic" on my desktop.

well your browser doesn't know what to do with the file... therefore the 
download.
and *your* server (and it's php setup) is not involved with this transaction at 
all.

if you want php to parse/process the output of the CGI script on
the third party server then you will have to submit the form to YOUR server and
have the php script that process the submit perform a request to the third party
machine, something like the following (untested, would require ini setting
'allow_url_fopen' to be on, takes no account of the encoding hell you might need
to go through, input sanitation/validation left out for brevity, you might
not have some of the functions mentioned):

<?php

$url      = 'http://www.csse.monash.edu.au/~jwb/cgi-bin/wwwjdic?9MGI'
$urlquery = http_build_query($_GET);
$response = file_get_contents($url.'&'.$urlquery);

// this is what the third party server gave you in reply to your request:
var_dump($response);


> 
> I'm a little lost here. Is this a problem of PHP not knowing what to do
> with the returned output? Is it an issue with the script at
> monash.edu.au that I need to contact the developer about? Is it
> something do to with how the form action is structured?
> 
> Please advise on how to diagnose and address this problem.
> 
> If necessary, please tell me where this issue would be best addressed if
> it is not a PHP issue.

it's not a PHP issue (yet) because you have yet to involve php at any stage ...
no doubt it will become a php issue in the near future ;-)

> 
> Thank you for your time and help.
> 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to