in reply to grabbing webpage data w/o additional modules

No. Your argument to IO::Socket::INET->new is not a URL. IO::Socket cannot parse URL's and does not know what to do with them. That's what LWP is for. Since you're re-inventing the wheel by not using any common HTTP/LWP modules, you have to actually re-invent it. You need to set up a network connection to the web server at port 80, and send properly formatted HTTP requests to the server, and parse the HTTP responses that you get back from it. The argument to that 'new' call should be (in its simplest form; see IO::Socket::INET for details) a "hostname:port" string only.
  • Comment on Re: grabbing webpage data w/o additional modules

Replies are listed 'Best First'.
Re: Re: grabbing webpage data w/o additional modules
by ImpalaSS (Monk) on Nov 22, 2000 at 21:08 UTC
    Hey,
    I was reading that link you provided, and i noticed this:
    $sock = IO::Socket::INET->new(PeerAddr => 'www.perl.org', PeerPort => 'http(80)', Proto => 'tcp');
    So, can i change the www.perl.org to www-mat.nextel.com but how can i route it to a certian directory, and on top of that, to a script with certian parameters?
    Thanks again

    Dipul
      You need to learn to speak HTTP. All IO::Socket does is help you establish network connections. It doesn't do anything as far as the protocol you use on top of that connection (HTTP). After you establish your connect, you need to send a properly formatted HTTP request (e.g.:
      GET /some/directory/file/script.whatever?arguments HTTP/1.0 Host: www.example.com
      And parse the response headers that you get in reply:
      HTTP/1.1 500 Internal Server Error Server: whatever Content-type: text/html My bad.
      See http://www.w3.org/ for details on the HTTP protocols, or examine the LWP and/or the HTTP set of modules for information. You are FAR better off finding a way to use an existing module. Good luck.