如何直接将数据从应用发布到网页?

时间:2018-05-14 10:25:03

标签: php android

我正在尝试使用此card.io应用扫描信用卡。

https://github.com/card-io/card.io-Android-source

因此,在应用程序中,一旦您扫描了卡片,就会有一个“发送”按钮,可以将卡号发送到您要发送的位置。

public void sendMessage(View view) {
    Intent intent = new Intent(this, DisplayMessageActivity.class);
    EditText editText = (EditText) findViewById(R.id.editText);
    String message = editText.getText().toString();
    intent.putExtra(EXTRA_MESSAGE, message);
    startActivity(intent);
}

我想将此卡号直接发送到网页,卡号将自动显示在卡号字段中。 https://cdt-co.000webhostapp.com/customer/checkout_guest/ellington_checkout.php

可以这样做吗?如果是的话怎么样?

希望你能提供帮助。谢谢!

1 个答案:

答案 0 :(得分:0)

您可以将其作为GET参数发送为

https://cdt-co.000webhostapp.com/customer/checkout_guest/ellington_checkout.php?cardno=asdf1234

单击链接时的POST参数 或者将其添加为请求的标题

最简单的方法是将其作为GET参数发送。

修改

只是澄清一下。您的sendMessage函数如下所示:

public void sendMessage(View view) {
    EditText editText = (EditText) findViewById(R.id.editText);
    String message = editText.getText().toString();
    String url="https://cdt-co.000webhostapp.com/customer/checkout_guest/ellington_checkout.php?cardno="+message;
    final Intent intent = new Intent(Intent.ACTION_VIEW).setData( Uri.parse(url));
    activity.startActivity(intent);
}