Solved

Values to site using cookies

Posted on 2004-09-30
10
285 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
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
numbers ascending pyramid 101 212
simple java question 3 59
netstat -ano | find "8000" and taskkill /f /pid 2984 3 82
going to wrong jsp page 2 33
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
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 “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
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…

792 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