gpt4 book ai didi

php - 使用 C++ 打开 PHP 页面(执行查询)

转载 作者:行者123 更新时间:2023-11-29 19:02:36 27 4
gpt4 key购买 nike

我需要编写一些脚本来打开执行查询的 php 页面。特别是我必须登录/注册。我已经有查询和数据库可以执行此操作(我在我的网站上有一个有效的登录/注册)。我想使用 C++ 直接连接到服务器并从程序发送查询,但我听说由于安全原因这是不可行的(而且我什至无法连接到服务器,除非我直接从站点进行连接)。所以我在互联网上发现,最好的方法是在 .php 页面上编写与服务器的连接和查询,该页面将由 C++ 程序调用,该程序也在 POST 中传递变量(用户名和密码)登录或注册。我可以写php页面,但我不知道如何制作程序。
基本上,在伪代码中,我想这样做

//Things i already know how to do
- read username from console
- read password from console
- read if the user wants to login or register
//Things i don't know how to do
- send username, password (and if the user wants to login or register) to a php page that can execute the right queries and connect to the db
- perform all the checks on the username (not duplicated etc)

通过了解如何打开 php 页面,我还可以做我感兴趣的其他事情,例如创建用户在连接后所采取的操作的日志(事实上,登录后您可以在 DirectX 中玩一个小游戏,所以我可以上传分数或比赛时间等)非常感谢

最佳答案

您可以查看CURL library for C/C++

正常的控制台操作是微不足道的。当您从用户那里获取详细信息后,使用 curl 向服务器发起 [login] 请求。

关于php - 使用 C++ 打开 PHP 页面(执行查询),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43739392/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com