Jump to content

modemrat

New Members
  • Posts

    5
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

modemrat's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Ah ha! I see now. I did try to send the "Keep-Alive" in the command, but of course my feof() kept spinning. Duh!  Works like a charm now, thanks a lot!
  2. [quote author=printf link=topic=111517.msg453895#msg453895 date=1161192276] HTTP 1.0 and HTTP 1.1 are both single stream resources, the take in a single request and return a single response. They can not take any other response after a read request has been started on the stream. Other types of streams allow this, like SMTP, FTP, IMAP where the resource is kept open until a request to kill it is called, an error is triggered or the configured timeout is encounted. [/quote] I thought that unless it was specified otherwise in the headers (Connection: Close, as opposed to Connection: keep-alive), HTTP 1.1 automatically assumes a persistent connection.  Here is one site where this is talked about: [url=http://www.io.com/~maus/HttpKeepAlive.html]http://www.io.com/~maus/HttpKeepAlive.html[/url] So in theory, addition requests could be made and read, but I'm finding that practice is more consistent with what you are saying.
  3. I found that I should be using [b]pfsockopen [/b]instead of [b]fsockopen [/b] but I still end up with the same results.  Must be the way I am sending the commands.  I thought that between each command there is a \r\n but I don't get any repsonse on my second read.  Little help anyone? Thanks in advance.
  4. I want to retreive the HTML from a web server but I want to take advantage of a persistent connection instead of reconnecting for each page I need to GET.  I try to just re-write the GET command after my first write/read but it doesnt work.  Any ideas?  Thanks Code: [code] $host = "www.example.com"; $page1 = "Page1.html"; $page2 = "Page2.html"; $connection = fsockopen ($host, 80); if ($connection) {     fwrite($connection, "GET /$page1 HTTP/1.1\r\nHOST: $host\r\n");     while (!feof($connection)) {         echo fread($connection,1024);     }     fwrite($connection, "GET /$page2 HTTP/1.1\r\nHOST: $host\r\n\r\n");     while (!feof($connection)) {         echo fread($connection,1024);     }     fclose ($connection); } else {   print "Unable to connect!\n"; } [/code]
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.