0

I want to take user inputs in JDoodle Api

I am using below Data

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

I am creating below context request

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

How do I take user input for below Code in 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);
    }
}
Rajat Patil
  • 1
  • 1
  • 4

1 Answers1

0

There is another field named as stdin. You can use it as.

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