Page 1 of 1

URL of a page that with a query string

Posted: Wed Jan 03, 2007 4:07 pm
by LiveFree
Hey All,

I'm not sure how to put this, but I need a way to find the URL of a request made to google translate through fopen().

Code: Select all

$handle = fopen("http://google.com/translate_t?langpair=".$langPair."&text=".$translateText."", "r");
$transPage = fread($handle, filesize("http://www.google.com/translate_t"));
The call to fopen() does work and it returns the entire google translate page of the inputted text and languages. However, I do not know what URL to put in the filesize() call for the fread.

The page I request, as far as I know, cannot be reached again with that same URL because I tried using the same URL as the fopen() in the filesize() call and it did not work.

Any Ideas?

Thanks,
Rick

Posted: Wed Jan 03, 2007 4:11 pm
by jyhm
$handle ??

Or maybe I'm misunderstanding you.

Posted: Wed Jan 03, 2007 5:20 pm
by Kieran Huggins
use file_get_contents() - it doesn't require the length argument, nor do you need to fopen, fclose, etc....