vb调用winInet API接口post数据到指定的url[2]

[入库:2005年8月18日] [更新:2007年3月24日]

本文简介:选择自 coolstar 的 blog

             (byval hhttprequest as long, _
             byval sheaders as string, _
             byval lheaderslength as long, _
             byval lmodifiers as long) as integer


public function postinfo$(srv$, port$, script$, postdat$)

  dim hinternetopen as long
  dim hinternetconnect as long
  dim hhttpopenrequest as long
  dim bret as boolean
  
  hinternetopen = 0
  hinternetconnect = 0
  hhttpopenrequest = 0
  
  'use registry access settings.
  const internet_open_type_preconfig = 0
  hinternetopen = internetopen("http generic", _
                  internet_open_type_preconfig, _
                  vbnullstring, _
                  vbnullstring, _
                  0)
  
  if hinternetopen <> 0 then
     'type of service to access.
     const internet_service_http = 3
     const internet_default_http_port = 80
     'change the server to your server name
     hinternetconnect = internetconnect(hinternetopen, _
                        srv$, _
                        port$, _
                        vbnullstring, _
                        "http/1.0", _
                        internet_service_http, _
                        0, _
                        0)
  
     if hinternetconnect <> 0 then
      'brings the data across the wire even if it locally cached.
       const internet_flag_reload = &h80000000
       hhttpopenrequest = httpopenrequest(hinternetconnect, _
                           "post", _
                           script$, _
                           "http/1.0", _
                           vbnullstring, _
                           0, _
                           internet_flag_reload, _
                           0)
  
        if hhttpopenrequest <> 0 then
           dim sheader as string
           const http_addreq_flag_add = &h20000000

本文关键:vb url post
  相关方案
Google
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top