0

我想在 JDoodle Api 中接受用户输入

我正在使用以下数据

 $postData = array(
            "script" => $code,
            "language" => $language,
            "versionIndex" => "2",
            "clientId" => "ed3d8b92ac70bc1c3ad2382d334afc1d",
            "clientSecret" => $hiddenKey
        );

我正在创建以下上下文请求

 $context = stream_context_create(array(
            'http' => array(
                'method' => 'POST',
                'header' =>  "Content-Type: application/json\r\n",
                'content' => json_encode($postData)
            )
        ));

如何在 JDoodle Api 中为以下代码获取用户输入?

import java.util.Scanner;

public class MainClass {
    public static void main(String[] Args) {
        System.out.println("Enter x = ");
        Scanner scanner = new Scanner(System.in);
        int x = scanner.nextInt();
        System.out.println("X = "+x);
    }
}
4

1 回答 1

0

还有另一个名为 stdin 的字段。您可以将其用作。

$postData = array(
            "script" => $code,
            "language" => $language,
            "versionIndex" => "2",
            "clientId" => "ed3d8b92ac70bc1c3ad2382d334afc1d",
            "clientSecret" => $hiddenKey,
            "stdin" => "YOUR_INPUT"
        );
于 2020-11-05T14:27:26.040 回答