0

So I found this code:

data=$(curl \
  --silent \
  --user-agent "ShellCheck@github.com/lollek/scripts-and-stuff" \
  --data-urlencode "script@$file" \
  "http://www.shellcheck.net/shellcheck.php")

Here is full code: https://github.com/lollek/scripts-and-stuff/blob/master/bin/shellcheck

Is it possible to make the same request using php, and if yes, how can I do it? I mean just sending my code ($file) to shellcheck.net/shellcheck.php and get request from it. So, somebody have any idea?

@edit

I found something like this:

$curl = curl_init();
curl_setopt_array($curl, array(
    CURLOPT_URL => 'http://www.shellcheck.net/shellcheck.php'
));
$resp = curl_exec($curl);
curl_close($curl);

But how can I send here my $file?

@edit2

Now I'm trying something like this:

<?php
   if( $_REQUEST["code"])
   {
    echo "Your code: ". $_REQUEST['code']. "<br />";      
    $data = $_REQUEST['code'];
    $curl = curl_init();
    curl_setopt($curl, CURLOPT_URL, "http://www.shellcheck.net/shellcheck.php"); 
    curl_setopt($curl, CURLOPT_POSTFIELDS, $data); 
    $resp = curl_exec($curl);
    curl_close($curl);
    exit();
   }
?>
<html>
   <body>

      <form action="<?php $_PHP_SELF ?>" method="POST">
         Code: <input type="text" name="code" />
         <input type="submit" />
      </form>

   </body>
</html>

But still nothing :/

Will
  • 24,082
  • 14
  • 97
  • 108
Mateusz
  • 323
  • 2
  • 11
  • 23

0 Answers0