dook0034 2010-12-25 23:03
浏览 43

HttpWebRequest POST并在登录后从php脚本中检索数据

Hello guys i am newbie to this stuff so i'll try to explain my problem.I am building application that retrieve data after login to php script that looks like this:

https://zamger.etf.unsa.ba/getrssid.php

(see the page source for php scirpt definition)

and definition(source) here:

Korisničko ime (UID): Šifra:

After i login it shows me data that i must collect like this:

RSSID: 1321B312 (this is only data that it shows and nothing else)

I must do this with httpwebrequest but don't know how i tried to do it with POST(data) but it always give me the defnition of php script as response.But i need response to be like "RSSID: 1321B312" not as script definition mentioned above...please heeelp ASAP....

  • 写回答

1条回答 默认 最新

  • dsx58940 2010-12-25 23:16
    关注

    Define a form action to begin. So if the same page, getrssid.php, will be processing the form, use:

    <form action="getrssid.php" method="POST">
    

    After that, you must code getrssid.php to accept the incoming data via POST. POST data is stored in the PHP variables $_POST['inputname']. So if you have the input name as "login", the value entered will be stored in $_POST['login']. Same thing applies for the password.

    So, here's a sample of what a basic POST data handling script should look like. Note that this script does not verify the login credentials, sanitize the inputs, or anything of the sort. It is just to show you how to handle POST DATA.

    <?php
    if (isset($_POST['login']) && isset($_POST['pass'])){
      // Form is submitted.
      echo 'RSSID: 1321B312';
    } else {
     // Form is not submitted.
     // Display Form.
     echo 'Form HTML here';
    }
    
    ?>
    

    If you are really server conscious, you should put the if ... else statement in the opposite order so the most likely outcome (form not submitted) is evaluated first.

    Merry Christmas!

    评论

报告相同问题?

悬赏问题

  • ¥60 pb数据库修改或者求完整pb库存系统,需为pb自带数据库
  • ¥15 spss统计中二分类变量和有序变量的相关性分析可以用kendall相关分析吗?
  • ¥15 拟通过pc下指令到安卓系统,如果追求响应速度,尽可能无延迟,是不是用安卓模拟器会优于实体的安卓手机?如果是,可以快多少毫秒?
  • ¥20 神经网络Sequential name=sequential, built=False
  • ¥16 Qphython 用xlrd读取excel报错
  • ¥15 单片机学习顺序问题!!
  • ¥15 ikuai客户端多拨vpn,重启总是有个别重拨不上
  • ¥20 关于#anlogic#sdram#的问题,如何解决?(关键词-performance)
  • ¥15 相敏解调 matlab
  • ¥15 求lingo代码和思路