|  | 
 | ||||
|        | |||||
|  | ||||||
| Related Syntax | Other Library Functions | |||||
| function | HttpRequestSetProxy | 
| Library: HTTP support (OMHTTP) Include: omhttp.xin | 
define function HttpRequestSetProxy
            modifiable  stream   Request
   host     value       string   Host
   port     value       integer  Port optional initial { 80 }
Argument definitions
Use HttpRequestSetProxy to set the proxy server to be used for an HTTP request.
You must include the following line at the beginning of your OmniMark program:
include "omhttp.xin"
You must create an HTTP request with HttpRequestSetFromUrl
After you use HttpRequestSetProxy, you can send  a request with HttpRequestSend.
The following program requests the OmniMark home page via a proxy server. You should set the appropriate values of proxy-server and proxy-port for the proxy server you are using.
  include "omhttp.xin"
  
  global HttpRequest Request
  global HttpResponse Response global stream proxy-server initial {"proxy.mycompany.com"}
  global integer proxy-port initial {80}
  
  process
  
      HttpRequestSetFromUrl Request from "www.omnimark.com:80"
      HttpRequestSetProxy Request host proxy-server port proxy-port
  
      HttpRequestSend Request into Response
      do unless HttpObjectIsInError Request
          output "%n<RESPONSE>%n"
          repeat over Response
              output key of Response
                  || " = "
                  || Response || "%n"
          again
      else
          local stream Report variable
          HttpObjectGetStatusReport Request into Report
          output "%n<REQUEST FAILED>%n"
          repeat over Report
              output Report || "%n"
          again
      done
Copyright © Stilo International plc, 1988-2008.