如何生成URL的php链接

本文关键字:php 链接 URL 何生成 | 更新日期: 2023-09-27 18:17:20

这是短信发送者网站,我想为此做一个c#函数。首先,我想生成链接。例如,我尝试:http://www.magtifun.ge/index.php?page=11〈en&act=1&user=mamasha&password=7504a,它不工作。

下面是该站点的Inspect Element

的代码
<!--
 Start user Action Form 
-->
<form action="index.php?page=11&lang=en" method="post" name="user_action">
    <!--
     Form Header 
    -->
    <div class="tbl_header">
        Log In
    </div>
    <!--
     Action 
    -->
    <input id="act" type="hidden" value="1" name="act"></input>
    <!--
     User 
    -->
    <p class="space_top"></p>
    <p>
        <input id="user" class="round_border medium_box" type="text" name="user"></input>
    </p>
    <!--
     Password 
    -->
    <p></p>
    <p>
        <input id="password" class="round_border medium_box" type="password" name="password"></input>
    </p>

我想这样做,但它不工作。这是正确的方式吗?

  {
     string URL = "http://www.magtifun.ge/index.php?page=11&lang=ge";
                WebClient webClient = new 
WebClient();
        NameValueCollection formData = new NameValueCollection();
        formData["act"] = "1";
        formData["user"] = "mamasha";
        formData["password"] = "75045a";
        byte[] responseBytes = webClient.UploadValues(URL, "POST", formData);
        string responsefromserver = Encoding.UTF8.GetString(responseBytes);
        Console.WriteLine(responsefromserver);
        webClient.Dispose();
        Thread.Sleep(5);
        send("591931123", "Hello vaxo");
        Console.ReadKey();
    }
    public static void send(string n, string t){
        ASCIIEncoding encoding = new ASCIIEncoding();
        string postDate = "recipient=" + n;
        postDate +="&message_body=" + t;
        byte[] date = encoding.GetBytes(postDate);
        WebRequest req = WebRequest.Create("http://www.magtifun.ge/scripts/sms_send.php");
        req.Method = "POST";
        req.ContentType = "application/x-www-form-urlencoded";
        req.ContentLength = date.Length;
        Stream stream = req.GetRequestStream();
        stream.Write(date, 0, date.Length);
        stream.Close();
        WebResponse respons = req.GetResponse();
        stream = respons.GetResponseStream();
        StreamReader st = new StreamReader(stream);
        Console.WriteLine(st.ReadToEnd());
        st.Close();
        stream.Close();
    }
}

}

如何生成URL的php链接

必须对http://www.magtifun.ge/index.php页面执行POST请求。我想如果没有cookie它将无法工作,因为该站点需要授权。