[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Values to site using cookies

Posted on 2004-09-30
10
Medium Priority
?
316 Views
Last Modified: 2010-03-31
Hi,

I had a post similiar to this and it got stuck so i'm posting another here.

I tried to send values from a java application to the following site:
http://websms.starhub.com/websms/sendSMS/index.jsp

but it doesn't work. I've checked the http and POST/GET request and found that it sent its values to another server somewhere else.

GET http://server-sg.imrworldwide.com/a1.js HTTP/1.0

Accept: */*

Referer: http://websms.starhub.com/websms/session/p_checkSession3.jsp?nR=6591838845&n=testname

It seems that it requires cookies to pass through but i have no idea on how to do it.
So is there anyone that can help and try on that site?

last post: http://www.experts-exchange.com/Programming/Programming_Languages/Java/Q_21138679.html
0
Comment
Question by:TPoly
  • 2
  • 2
  • 2
  • +2
8 Comments
 
LVL 12

Accepted Solution

by:
Giant2 earned 500 total points
ID: 12187750
0
 
LVL 35

Assisted Solution

by:TimYates
TimYates earned 500 total points
ID: 12187770
I would use HttpClient... It handles cookies and forwarding and everything for you...

http://jakarta.apache.org/commons/httpclient/

I'll post an example when I get to work...

0
 
LVL 1

Assisted Solution

by:frank_van_puffelen
frank_van_puffelen earned 500 total points
ID: 12187784
I'm not entirely sure if I understand you correctly, so please excuse me if my comment doesn't make sense.
If you're trying to send a cookie to a server that you're accessing through a URLConnection, you can set the cookie as a request property.
   urlConn.setRequestProperty("Cookie", cookieString);
Of course since these are coookies you can have multiple values in that single cookieString. That why you'll find a nice function on http://www.rgagnon.com/javadetails/java-0092.html

If you're trying to accomplish something else, then please provide a small code sample so I can see what you're working on.
If it's related to that specific SMS sending side, then I'm afraid I can't be of much help.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 1

Expert Comment

by:frank_van_puffelen
ID: 12187790
Giant beat me to it.

Tim's suggestion could also work, but requires you to use a different library that's not anywhere near a drop-in replacement for Sun's HTTP client. But the Apache commons-httpclient is a very good implementation, so you might indeed want to consider it.
0
 
LVL 92

Assisted Solution

by:objects
objects earned 500 total points
ID: 12187838
to get the cookie value:

String cookie = connection.getHeaderField("set-cookie");

then to set it in subsequent request:

connection.setRequestProperty("cookie", cookie);
0
 
LVL 13

Expert Comment

by:Webstorm
ID: 12189096
Hi all,

>> GET http : / /server-sg.imrworldwide.com/a1.js HTTP/1.0
The  *.imrworldwide.com  domain name is used by the "Red Sherriff" spyware (see http://cexx.org/sheriff.htm).

0
 
LVL 13

Expert Comment

by:Webstorm
ID: 12189174
0
 
LVL 12

Expert Comment

by:Giant2
ID: 12189209
Webstorm,
what are you posting in this thread?
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses
Course of the Month18 days, 12 hours left to enroll

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question