Solved

Values to site using cookies

Posted on 2004-09-30
10
256 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
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
The viewer will learn how to implement Singleton Design Pattern in Java.

743 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

10 Experts available now in Live!

Get 1:1 Help Now