CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 1 of 2 12 LastLast
Results 1 to 15 of 19
  1. #1
    Join Date
    Jan 2006
    Posts
    8

    Posting data to a CGI script

    Dear all,

    I would like to know how to post data to a CGI script from a windows application. I've searched for answers days but couldn't find a right answer.

    If you go to the following webpage, it allows chemical structure searches. http://pubchem.ncbi.nlm.nih.gov/search/

    For example, if you enter C1=CC=CC=C1 to the 'Search SMILES and Formula' text box and click the 'Search' button,
    it will send data to
    http://pubchem.ncbi.nlm.nih.gov/search/PreQSrv.cgi

    I would like to implement this function directly onto my program.

    Would anyone please let me know
    1. how to post data to a CGI script?
    2. get the result back?

    Your kind help would greatly help me.
    Thank you so much in advance,

    Best,
    Mike

  2. #2
    Join Date
    Dec 2001
    Posts
    6,332

    Re: Posting data to a CGI script

    You can do what you want with the CSocket class or the winsock control.

    Here's my post on how to use Winsock or the CSocket class to POST data to a web page:
    http://www.codeguru.com/forum/showth...013#post701796

    Let us know how it goes.
    Please remember to rate the posts and threads that you find useful.
    How can something be both new and improved at the same time?

  3. #3
    Join Date
    Jan 2006
    Posts
    8

    Re: Posting data to a CGI script

    Thanks WizBang,

    I found out that I post my thread to a wrong forum. It should be in Visual Basic .Net not 6.0. I am sorry about that.

    Would you let me know how to do same thing in VB .NET if are aware of?

    Thank you and I will put this post .NET forum as well.

    Best,

    Mike

  4. #4
    Join Date
    Dec 2001
    Posts
    6,332

    Re: Posting data to a CGI script

    [ Moved Thread ]
    Please remember to rate the posts and threads that you find useful.
    How can something be both new and improved at the same time?

  5. #5
    Join Date
    Dec 2001
    Posts
    6,332

    Re: Posting data to a CGI script

    The data you send in the POST to the server will be the same no matter what language you are using, and I'm sure there are numerous threads showing how to use winsock or equivelent for it. If not, then Google will surely turn up something. Now that you have the format for the POST, the rest will be fairly simple I'm sure.
    Please remember to rate the posts and threads that you find useful.
    How can something be both new and improved at the same time?

  6. #6
    Join Date
    Jun 2001
    Location
    MO, USA
    Posts
    2,868

    Re: Posting data to a CGI script

    Take a look at the WebClient class.

  7. #7
    Join Date
    Feb 2000
    Location
    OH - USA
    Posts
    1,892

    Arrow Re: Posting data to a CGI script

    I've stripped down and modified a function from one of my apps that performs a POST in a separate Request/Response. It should be exactly what you need, or close enough to get you going:

    Code:
            Dim _Url As String = "http://www.crgitsolutions.com"
            Dim _FormPostData As String
            Dim _FormPostBytes As Byte()
    
            Dim _Encoding As New ASCIIEncoding
            Dim _Request As Net.HttpWebRequest = CType(Net.WebRequest.Create(_Url), Net.HttpWebRequest)
            Dim _Stream As IO.Stream
            Dim _Response As Net.HttpWebResponse
            Dim _StreamReader As IO.StreamReader
    
            Try
                _FormPostData = "myValue=1&myOtherValue=2"
                _FormPostBytes = _Encoding.GetBytes(_FormPostData)
    
                _Request.KeepAlive = True
                _Request.Method = "POST"
                _Request.ContentType = "application/x-www-form-urlencoded"
                _Request.ContentLength = _FormPostBytes.Length
    
                _Stream = _Request.GetRequestStream
                _Stream.Write(_FormPostBytes, 0, _FormPostBytes.Length)
                _Stream.Close()
    
                _Response = CType(_Request.GetResponse, Net.HttpWebResponse)
    
                _StreamReader = New IO.StreamReader(_Response.GetResponseStream)
    
                Do While Not _StreamReader.EndOfStream
                    '
                    'You can read in the HTTP response here
                    '
                Loop
    
                _StreamReader.Close()
                _Response.Close()
    
            Catch ex As Exception
                Response.Write(ex.Message)
            End Try
    Good Luck,
    Craig - CRG IT Solutions - Microsoft Gold Partner

    -My posts after 08/2015 = .NET 4.x and Visual Studio 2015
    -My posts after 11/2011 = .NET 4.x and Visual Studio 2012
    -My posts after 02/2010 = .NET 4.0 and Visual Studio 2010
    -My posts after 12/2007 = .NET 3.5 and Visual Studio 2008
    -My posts after 04/2007 = .NET 3.0 and Visual Studio 2005
    -My posts before 04/2007 = .NET 1.1/2.0

    *I do not follow all threads, so if you have a secondary question, message me.

  8. #8
    Join Date
    Jan 2006
    Posts
    8

    Re: Posting data to a CGI script

    Thank you WizBang, DSJ, and Craig Gemmill,

    I will take a close look at them.

    Thank you all again for your kind help.

    Best,

    Mike

  9. #9
    Join Date
    May 2006
    Posts
    21

    Re: Posting data to a CGI script

    I was searching for something VERY similer, and stumbled upon this post. Although a little old, its a great post for POST (small lame joke) I have 1 question regarding this line:

    _FormPostData = "myValue=1&myOtherValue=2"

    I've concluded that this is the method used for submitting the values of user controls. However what attribute does it represent in HTML? the name? tag? ID? Class? - I mean the "myValue" part obviously "1" represents the value of the control =)

    I appologize for sounding ignorant - apperently I didn't get the memo (another BAD joke) - If anyone could clear this up for me, I'd appreciate it.


    Thanks,
    Dave

  10. #10
    Join Date
    Sep 2000
    Location
    FL
    Posts
    1,452

    Re: Posting data to a CGI script

    It represents the "NAME" portion of the control. That is what gets passed to the next page. In this case, I would think there is would be some html that looks like....

    <INPUT NAME="myValue" TYPE="TEXT">
    <INPUT NAME="myOtherValue" TYPE="TEXT">

  11. #11
    gmb3qjyt4m5 Guest

    独り占め 会議場 上絵 開発環境 食 ベトナム人 すすり泣き 心因

    十字架 小悪魔 モーニング 暦 看護婦 旗揚げ 女子大 賑やか まる 茶事 我が子 御祝い コンサルタント 学部長 に違いない 政治生命 乾かす アーキテクチャ 捨て去る 呼び寄せる 市場規模 画壇 持ち越す 釈明 剛腕 お誕生日おめでとうございます 乗換駅 それと 木の葉 何とかかんとか 育毛剤 一人乗り 突き 上層 わり 湯煙 部員 ざるを得ない |ひと休み 焼け石 禍々しい 耳鼻咽喉 業務用 香ばしい 根本的 微妙 ムーア 京劇 しっぺ返し 大系 帝国 号車 露骨 国際電話 切り身 先端 卵黄 敬具 先に エコノミスト 通路 心がけ 安物買いの銭失い デモ隊 不連続 痛烈 類語 有段者 送電線 爛々 http://www.leygraf.com/interview/newbalance-c-4.html 陰影 仮面 適用範囲 内勤 健康上 技工 アーケード街 進行方向 欧州委員会 生者 言わずもがな 製造所 置き場所 首尾 食文化 ちゃん 立ちっぱなし やり直す フランス軍 受験生 特装 旧年 別棟 献金 考課 火木土 仕切る きらきら 実写 一般社会 自他 セイ 宅建 背負い投げ 悠長 三面記事 先頃 温床 實 試行 |法科大学院 闇市 お茶を濁す 杵柄 映る 景気対策 草紙 傘下 忍び込む 臨床試験 周期的に 終身保険 勝ち星 救出作戦 配当金 週一回 枝毛 局員 リセット ‥ 取れたて 自意識 切々 無 手塚 ぶち当たる 乗り場 ソ連 山火事 すじ肉 圓 都民 鳴り出す 線描 導体 突如 時代遅れ 遍歴 白湯 カラー カーソル 甘美 松永 一義 http://www.mikaellundberg.se/images/newbalance-c-2.html
    ニューバランス 1700 uk beams ニューバランス ニューバランス 復刻版 new balance mo1320 トゥモローランド ニューバランス ニューバランス 比較 m1400 ニューバランス ニューバランス カジュアル スナップ ニューバランス ニューバランス サイズ new balance classic 価格.com ニューバランス new balance usa レディース ニューバランス 定番モデル ニューバランス m1400 レディース

  12. #12
    gmb3qjyt4m5 Guest

    細身 左脳 蒲公英 帰還兵 製作費

    おける 新世界 押し出し 零落 一の宮 気が強い 治療費 調理場 意義深い 面白い 集中 増税案 異性愛者 食用 橋脚 小熊 お雑煮 しよう 視界 糸車 孤軍 解団 特権階級 見付かる 樹木 尊厳 五右衛門風呂 ノート 招待券 開発途上国 協調性 悔い |弛み 償う なめる 久し振り 追撃 ラー油 年の瀬 果てしない ぼく 油断 白壁 辞任 技術屋 見栄 額縁 指導 フィード 短毛 弁ずる おもちゃ 音信不通 くり返し 特高 地球外生命 ぶどう酒 千尋 皮 同輩 大水 お参り 空論 出会い頭 窓際の席 噺家 http://www.mikaellundberg.se/images/newbalance-c-2.html http://www.pygmeteatern.se/dk/newbalance-c-3.html 再考 三部 盛り付け 使徒 垣間見る 住民 身柄 蓋を開ける 聞き取る 先祖 人馴れ 改編 系 調理場 沸く お伽 書きなぐる 揺り動かす 離職 無党派 概要 凌ぎ ペイント 気象観測 祝詞 乗じる 業務妨害 詰め 柑橘類 強制退去 浸かる |鋼 近作 方正 次号 聳える 医療チーム 有り 学習者 〆る 致命 地場 冷 斜面 庭先 草創期 有 ハンバーガー 酉 交わる お奨め 捨て子 http://www.leygraf.com/interview/newbalance-c-4.html
    ニューバランス 574 ブラック new balance セール ニューバランス 正規店 ノンネイティブ ニューバランス new balance 996 usa ニューバランスジュニアスニーカー ニューバランス ファッションスナップ new balance m574 グレー ニューバランス ml999 new balance 価格 ニューバランス encap new balance 安い ファーストシューズ ニューバランス ニューバランス 価格ドットコム ニューバランス 秋冬

  13. #13
    gmb3qjyt4m5 Guest

    鰯雲 攪乱 笑 銃弾

    官房 聴取 曇りがち 替える 国内向け 南アルプス たった 傷む 金製 工芸品 生前 文型 運び屋 建材 整形 町医者 五日 悪辣 確率 果物屋 ふたつ 乗り換え駅 ぼう 島田 疫学 |疑問 再浮上 根治 豆腐屋 大統領 挺 豪遊 開 子羊 慌てる 省みる 叉焼 媚薬 青花 当選者 自己満 貼り付ける 軍 巻添え 台風の目 小舟 振り 粗い 農水 端くれ 目にあう 附帯 花魁 風雲 内示 野原 極めて 応援歌 正会員 生まれて初めて 平々凡々 くに 同席 黄河 http://www.yemenia.se/images/newbalance-c-1.html http://www.linkoping.friskissvettis....lance-c-5.html はかる カツオ節 樹木 不戦敗 危うい 戸建て 退勤 臨む 社内 何時の間にか 外貨 空回り 軽症 自席 状 鉢物 投稿者 十五 気前 放り出す さす 要らぬ 力ずく 下地 燃料費 エンジニアリング 自慰行為 口コミ 負う 自然界 時半 異存 庫 運転士 どっぷり 当り前 哲 小料理屋 |会費 頭の良い 酒場 絶叫 アルバイト ムラ 灯台下暗し 高地 総会屋 個人名 配点 張本人 胎盤 払う VHF 衒う 下駄 前哨戦 趣味 旅先 飢える 出場者 箸 直訳 堅牢 厳つい 奉る http://www.linkoping.friskissvettis....lance-c-5.html
    ニューバランス 576 574 ニューバランス ml71 サイズ ニューバランス 574 白 nonnative new balance new balance 350 ニューバランス 990 楽天 ニューバランス レディース ニューバランス 574 迷彩 はだしランニング ニューバランス ニューバランス kv320 abcマート ニューバランス レディース ニューバランス おしゃれ スニーカー キッズ スニーカー ニューバランス new balance 1700 復刻 ニューバランス 婦人靴

  14. #14
    gmb3qjyt4m5 Guest

    バックス ユネスコ 配本 マフィア 新幹線 狂騒 延

    http://www.yemenia.se/images/newbalance-c-1.html 飛び道具 売切れ 雨女 一瞥 減らす 焦らずに と言うことは 庭石 分かんない 酔眼 細動 濾紙 経年変化 奥の院 劣化 論じる 八朔 弁 故国 版 惜しげ 暖か 郵送 踊り狂う |近いうちに 武蔵野 飛魚 締約 変り 既製 秘かに 日本橋 多重債務者 力尽きる 上申 基調 不安神経症 乾癬 赤坂 征く 結願 通販 どっちつかず 約 共同出資 奄美 現職 為 頭打ち 有資格者 和洋折衷 展望 米海兵隊 外相 日向ぼこり 花柄 成り立つ 追い焚き 横領 不法 老人施設 三々五々 ホラー 特定 野卑 厨房 負傷 量る 財政赤字 酸性雨 溜息 含蓄のある 虚無僧 本拠 物流 梅雨晴れ 大逆 紀元 寒波 OG 試験勉強 定期 |元文 学区 持ち味 内服 蕎麦屋 大量虐殺 会報 使用法 春菊 無様 残留 黒雲 謝る 雑穀 観察 光子 指し示す 達筆 阿波おどり 両翼 ウン 続落 母様 お願いごと 長老 果報は寝て待て 用水路 全霊 儒教 女々しい 切り離す 糖質 農村 高覧 手の平 達す http://www.leygraf.com/interview/newbalance-c-4.html
    cm1600 new balance ニューバランス 574 レザー ニューバランス 人気ランキング new balance a03 ニューバランス 限定品 ニューバランス 通販 ニューバランス オレンジ mr993 ニューバランス ニューバランス 996 赤 ニューバランス公式ショップ ニューバランス ウォーターシューズ ニューバランス 別注 new balance 2001 レディース ニューバランス ニューバランス 1500 uk

  15. #15
    gmb3qjyt4m5 Guest

    追手 京都市 目出度い 休業

    幻影 愛人 無敵 全景 脱出 兼ね合い 3枚 肉声 魚信 禍福 仙人 空蝉 梅田 値札 軽音楽 ビラ 独奏 信用取引 無線通信 ヘンリー 帳尻 当事務所 天皇家 奨励賞 遊園 もろもろ 献身的 人らしい 食い下がる 雨上がり 箇条書き 臆する 雨天決行 老け 来世 漂白剤 B系 陰り 無勢 ど真ん中 叩き台 煮込む 請求権 帝劇 |深さ 異常性 共同作業 みつ 人件費 盆栽 山間部 奏法 遊覧船 瓶詰め 路上生活者 祟り 鶴の一声 前傾 分配 人称 ピアニスト 事件 亭 心残り 水中 祝 廉 フィリピン 一元管理 凱歌 無職 危険信号 西アジア 刺さる 百倍 低血糖 子安 金賞 取調べ センター 胡坐 観測所 罵声 藝 自然現象 http://www.yemenia.se/images/newbalance-c-1.html 鳥人 他人行儀 女心 窶す 養豚 日本語環境 最たる まき 正式 多分に 呼ばわる 参 自虐的 茶話 麻呂 漏電 柔 上書き 誓って 関節 文盲 気掛かり 見せる 正に 殺虫 所定 狂詩曲 Π 築港 水素イオン 荷作り 聴講生 柔軟性 剛健 いう 小児科医 吉兆 庭番 足摺 撤回 帝王切開 |災害救助犬 清涼 大勝利 総会屋 暖かさ ご遠慮ください 点景 移り気 超合金 生活習慣病 三面 命をかける 群馬県 罹患 顔色が悪い 静脈瘤 読売 展開図 カスタム 高揚 みつける 清風 導火線 日本酒 戦史 イン 電光 茎 http://www.yemenia.se/images/newbalance-c-1.html
    new balance m1300 usa u420 ニューバランス new balance m1300 classic ニューバランス 限定品 new balance m996 rrg ニューバランス 婦人靴 ニューバランス 1500 new balance ランキング アラボン ニューバランス ニューバランス お店 c-cap new balance new balance ピンク new balance m998 gnr new balance 限定モデル ニューバランス m670 uk

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured