URL of a page that with a query string

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
LiveFree
Forum Contributor
Posts: 258
Joined: Tue Dec 06, 2005 5:34 pm
Location: W-Town

URL of a page that with a query string

Post 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
User avatar
jyhm
Forum Contributor
Posts: 228
Joined: Tue Dec 19, 2006 10:08 pm
Location: Connecticut, USA
Contact:

Post by jyhm »

$handle ??

Or maybe I'm misunderstanding you.
User avatar
Kieran Huggins
DevNet Master
Posts: 3635
Joined: Wed Dec 06, 2006 4:14 pm
Location: Toronto, Canada
Contact:

Post by Kieran Huggins »

use file_get_contents() - it doesn't require the length argument, nor do you need to fopen, fclose, etc....
Post Reply