Solved

Values to site using cookies

Posted on 2004-09-30
10
268 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
10 Comments
 
LVL 12

Accepted Solution

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

Assisted Solution

by:TimYates
TimYates earned 125 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 125 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
 
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 92

Assisted Solution

by:objects
objects earned 125 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
best (free) software to access postgres db (java) 1 32
eclipse formatting 6 71
jar file executable 12 39
fibonacci ten numbers 4 26
After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

911 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now