djarvis270 Posted January 9, 2008 Share Posted January 9, 2008 Hi there, I need to create a PHP script, but I'm having trouble getting started: The script is supposed to run from the terminal/command line and act as a front-end to Google's Translate Text web service. The page is found at http://translate.google.com/translate_t I need to be able to make a POST request in my PHP script to that page so I can have access to the POST variables, mainly the 2 text areas (original text and translated text) and translation flag vars. My question is... how? I have been screwing around with fopen() and fsockopen(), but to no avail. Any hints/suggestions would be appreciated. Thanks in advance. Quote Link to comment https://forums.phpfreaks.com/topic/85117-solved-anyone-care-to-help-a-noobie/ Share on other sites More sharing options...
mrdamien Posted January 9, 2008 Share Posted January 9, 2008 Its the structure thats tricky. For example: POST /path/script.cgi HTTP/1.0 From: frog@jmarshall.com User-Agent: HTTPTool/1.0 Content-Type: application/x-www-form-urlencoded Content-Length: 32 home=Cosby&favorite+flavor=flies All I can do is point you in that direction - sorry. Quote Link to comment https://forums.phpfreaks.com/topic/85117-solved-anyone-care-to-help-a-noobie/#findComment-434214 Share on other sites More sharing options...
djarvis270 Posted January 9, 2008 Author Share Posted January 9, 2008 Thanks for the response... still lost however. I was hoping to be able to do this using a single php script in one file... Quote Link to comment https://forums.phpfreaks.com/topic/85117-solved-anyone-care-to-help-a-noobie/#findComment-434313 Share on other sites More sharing options...
rajivgonsalves Posted January 9, 2008 Share Posted January 9, 2008 you should use curl more information available at http://php.net/curl Quote Link to comment https://forums.phpfreaks.com/topic/85117-solved-anyone-care-to-help-a-noobie/#findComment-434317 Share on other sites More sharing options...
priti Posted January 9, 2008 Share Posted January 9, 2008 read this article i think its easy and quick http://curl.haxx.se/libcurl/php/examples/simplepost.html Quote Link to comment https://forums.phpfreaks.com/topic/85117-solved-anyone-care-to-help-a-noobie/#findComment-434334 Share on other sites More sharing options...
djarvis270 Posted January 9, 2008 Author Share Posted January 9, 2008 Thanks very much. I stumbled open curl a few hours after I made this post. Quote Link to comment https://forums.phpfreaks.com/topic/85117-solved-anyone-care-to-help-a-noobie/#findComment-434744 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.