Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- +++++++++++SAMPLE+++++++++++
- $target_path = "uploads/";
- $target_path = $target_path . basename( $_FILES['file']['name']);
- if(!move_uploaded_file($_FILES['file']['tmp_name'], $target_path)) {
- die("There was an error uploading the file, please try again!");
- }
- $file_path = $target_path;
- $scan = scanFile($file_path);
- $result = json_decode($scan);
- foreach($result as $av){
- echo($av->name . ' - ' . $av->result);
- echo('<br />');
- }
- */
- function scanFile($file_path) {
- $id='YourID';
- $token='YourToken';
- global $UPLOAD_DIRECTORY;
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_HEADER, 0);
- curl_setopt($ch, CURLOPT_VERBOSE, 1);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($ch, CURLOPT_URL, "http://v2.scan.majyx.net/scan.php");
- curl_setopt($ch, CURLOPT_POST, true);
- $post = array(
- 'token'=>$token,
- 'id'=>$id,
- 'file'=>'@'.$file_path,
- );
- curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
- $result = curl_exec($ch);
- $err = curl_errno($ch);
- $errmsg = curl_error($ch);
- if(!empty($err)){
- $result = $errmsg;
- }
- curl_close($ch);
- return $result;
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment