Hello, guys.
I would like to knoe how to do following example in java, instead of
PHP
--- start ---
$id = 1;
$postUrlData = array( 'id' => $id );
$ch = curl_init();
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($ch, CURLOPT_URL, "http://mysite/some-cgi" );
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postUrlData );
$data_returned = curl_exec( $ch );
curl_close( $ch );
if( $data_returned == "ok" )
echo "<pre>it's ok</pre>";
--- end ---
Regards,
Rodrigo
Alex Hunsley - 12 Apr 2006 09:05 GMT
> Hello, guys.
>
> I would like to knoe how to do following example in java, instead of
> PHP
Google is your friend.
Personally, I find Jakarta's HttpClient likeable and it doesn't soil the
carpet.
http://jakarta.apache.org/commons/httpclient/
Check out the tutorials for HttpClient at the above page, they include
doing GET or POST requests.
Thomas Fritsch - 12 Apr 2006 14:26 GMT
> I would like to knoe how to do following example in java, instead of
> PHP
[quoted text clipped - 16 lines]
> echo "<pre>it's ok</pre>";
> --- end ---
You can use URL and URLConnection as described in
http://javaalmanac.com/egs/java.net/Post.html

Signature
"Thomas:Fritsch$ops.de".replace(':', '.').replace('$', '@')