Results 1 to 5 of 5

Thread: How to send HTTP request from specific IP?

  1. #1
    Join Date
    Jun 2009
    Posts
    59

    How to send HTTP request from specific IP?

    Hi,
    I have small computer lab with the proper IP address, in this network I want to send HTTP request from any specific IP address but I want to specify my request from specific ip not from default one. I use much software but I am not able to get solution for my problem, for that I ask you please, give me some proper solution for that.

  2. #2
    Join Date
    Oct 2005
    Posts
    2,358

    Re: How to send HTTP request from specific IP?

    I make this project in my college project, in this project I use following code to send HTTP request from specific IP. I think this code will help you to solve your problem.

    public class clspeci
    {
    public static void main ( String args [] )
    {

    String argu = args [1];

    try {
    ADRES adres = new ADRES(argu);
    HttpADRESConnection conn = (HttpADRESConnection) adres.openConnection();
    InputStream arguuestStream = conn.getInputStream();
    BufferedOutputStream test = new BufferedOutputStream(new FileOutputStream("your web address"), 4 * 1024);
    byte b = 0;
    while ((b = (byte) arguuestStream.read()) != -1) {
    test.write(b);
    }
    test.flush();
    } catch (Exception ex) {
    ex.printStackTrace(System.err);
    }


    }
    I'm the Proud Owner of the most dangerous weapon
    known to man kind: Human Brain

  3. #3
    Join Date
    Apr 2008
    Posts
    2,276

    Re: How to send HTTP request from specific IP?

    I give you ASP code for solving your problem this code take short time to compile and using this code your program give better response. In this code you have to design front end and use following in your asp file.

    xmlRequest = "<?xml version=""1.0"" encoding=""utf-8""?>" &_
    "<GetItemRequest xmlns="" Components"">" &_
    "<RequesterCredentials>" &_
    "<AuthToken>"&AuthToken&"</AuthToken>" &_
    "</RequesterCredentials>" &_
    "<ItemID>"&eBayItemID&"</ItemID> " &_
    "</GetItemRequest>"

  4. #4
    Join Date
    Apr 2008
    Posts
    2,277

    Re: How to send HTTP request from specific IP?

    I give you better solution for that because I also face this same problem in my network some one send packets using my ip address then I find out how they do like this, for that they use following java script.

    String req = "your web address";
    try {
    ADRES adres = new ADRES(req);
    HttpADRESConnection conn = (HttpADRESConnection) adres.openConnection();
    InputStream requestStream = conn.getInputStream();
    BufferedOutputStream test = new BufferedOutputStream(new FileOutputStream("url"), 4 * 1024);
    byte b = 0;
    while ((b = (byte) requestStream.read()) != -1) {
    test.write(b);
    }
    test.flush();
    } catch (Exception ex) {
    ex.printStackTrace(System.err);
    }

  5. #5
    Join Date
    May 2008
    Posts
    2,134

    Re: How to send HTTP request from specific IP?

    Use following steps for sending HTTP request from specific IP adders
    First, define an object to send. For that we write this code

    public class Message implements Serializable
    {
    private int senradres;
    private String msge;

    public Message(int id, String text) {
    senradres = id;
    msge = text;
    }
    public String getText() {
    return msge;
    }
    }
    In this step we wrap the socket's streams in object streams, and after that send the message across the socket
    Message txtmsg = new Message("45564", "Hi");
    Socket socket = new Socket(host, port);
    ObjectOutputStream out = new ObjectOutputStream(socket.getOutputStream());
    out.writeObject(txtmsg);
    but in this code the message can be retrieved and used by other IP and then returned object:
    ObjectInputStream in = new ObjectInputStream(socket.getInputStream());
    Message messageObject = (Message) in.readObject();
    String msge = messageObject.getText();

Similar Threads

  1. SMS from Python using HTTP request
    By thomasqueen in forum Software Development
    Replies: 1
    Last Post: 12-02-2013, 10:46 AM
  2. Replies: 5
    Last Post: 18-02-2011, 10:07 PM
  3. Send Http Request In Java
    By ramsun in forum Software Development
    Replies: 5
    Last Post: 26-02-2010, 09:55 PM
  4. How to fix http 400 bad request
    By Beans in forum Technology & Internet
    Replies: 3
    Last Post: 22-08-2009, 05:32 PM
  5. HTTP 400 Bad Request
    By adyf in forum Vista Help
    Replies: 2
    Last Post: 04-11-2008, 02:33 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,290,493.67457 seconds with 16 queries