Re: Remote cgi script function
| From: | Haddad Said | Date: | Mon, 24 Jun 2002 08:47:49 +0000 |
| Subject: | Re: Remote cgi script function | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-103548@lists.php.net to get a copy of this message | ||
Thanks John,
See when i echo $contents, the page displayed contains backgrounds and other
text from the remote site, how can i crop only the returned query and
display it in a page with my backgrounds etc
thanks
"John Holmes" <holmes072000@charter.net> wrote in message
news:000a01c21aef$f58fc0a0$b402a8c0@mango...
> > I am new to php, I would like to create a function that when called
> > sends text from a text box as a query to a remote cgi script ,e.g
> > http://www.anydomain.com/cgi-bin/script.cgi, and return
> > the results as
> a
> > variable so that i can echo the returned variable to an html page.
>
> <?
> $contents = "";
> $text = "whatever...";
>
> $ftext = urlencode($text);
>
> $fp =
> fopen("http://www.example.com/cgi-bin/script.cgi?text=" .
> $ftext,
> "r");
>
> while($data = fread($fp,1000))
> { $contents .= $data; }
>
> fclose ($fd);
>
> ?>
>
> The response is now in $contents. Adapt to your needs.
>
> ---John Holmes...
>