includes/http.php
changeset 462 42a49ceb2373
parent 411 d1a95497b68f
child 507 586fd7d3202d
equal deleted inserted replaced
461:717e71109645 462:42a49ceb2373
   354       echo "<p><b>GET URI:</b> " . htmlspecialchars($this->uri . $get) . "</p>";
   354       echo "<p><b>GET URI:</b> " . htmlspecialchars($this->uri . $get) . "</p>";
   355       echo "<p><b>POST DATA:</b> " . htmlspecialchars($post) . "</p>";
   355       echo "<p><b>POST DATA:</b> " . htmlspecialchars($post) . "</p>";
   356       echo "<pre>";
   356       echo "<pre>";
   357     }
   357     }
   358     
   358     
       
   359     $portline = ( $this->port == 80 ) ? '' : ":$this->port";
       
   360     
   359     $this->_fputs($connection, "{$this->method} {$this->uri}{$get} HTTP/1.1{$newline}");
   361     $this->_fputs($connection, "{$this->method} {$this->uri}{$get} HTTP/1.1{$newline}");
   360     $this->_fputs($connection, "Host: {$this->host}{$newline}");
   362     $this->_fputs($connection, "Host: {$this->host}$portline{$newline}");
   361     $this->_fputs($connection, $headers);
   363     $this->_fputs($connection, $headers);
   362     $this->_fputs($connection, $cookies);
   364     $this->_fputs($connection, $cookies);
   363     
   365     
   364     if ( $this->method == 'POST' )
   366     if ( $this->method == 'POST' )
   365     {
   367     {
   765       {
   767       {
   766         $i++;
   768         $i++;
   767         if ( $i > 1 )
   769         if ( $i > 1 )
   768           $get .= '&';
   770           $get .= '&';
   769         $value = urlencode($value);
   771         $value = urlencode($value);
   770         if ( !empty($value) )
   772         if ( !empty($value) || is_string($value) )
   771           $get .= "$name=$value";
   773           $get .= "$name=$value";
   772         else
   774         else
   773           $get .= "$name";
   775           $get .= "$name";
   774       }
   776       }
   775     }
   777     }