0

I'm integrating copyleaks API in my PHP project. Using this code for scanning the free text..

$webookUrl = 'https://example.com/prodparallel/copyleakCallback.php'; Here, I'm replacing the site name with example.com [I'm using my dev server URL]..

    $submission = new CopyleaksFileOcrSubmissionModel(
          "en",
          $base64data,
          "plagarism.txt",
          new SubmissionProperties(
            new SubmissionWebhooks("$webookUrl/{STATUS}"),
            false,
            null,
            true,
            6,
            1,
            true,
            false,
            new SubmissionAuthor('php-test'),
            new SubmissionFilter(true, true, true),
            new SubmissionScanning(true, new SubmissionScanningExclude('php-test-*'), null, new SubmissionScanningCopyleaksDB(true, true)),
            new SubmissionIndexing((array)[new SubmissionRepository('repoId')]),
            new SubmissionExclude(true, true, true, true, true),
            new SubmissionPDF(true, 'title', 'https://lti.copyleaks.com/images/copyleaks50x50.png', false),
            new SubmissionSensitiveData(false, false, false, false, false, false, false, false)
          )
        );

    $copyleaks->submitFile($product,$loginResult,$scanId,$submission);

After this, I check in https://api.copyleaks.com/dashboard/businesses/scans, The scanning process is done.. but webhook URL is not triggered.

[Completion webhook is still sending]

I'm using a PHP page as webhook URL, here is the code of https://example.com /prodparallel/copyleakCallback.php

$uri_path = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);

$uri_segments = explode('/', $uri_path);

if(isset($uri_segments[2]) && $uri_segments[2] == 'completed'){ do this////

}else if(isset($uri_segments[2]) && $uri_segments[2] == 'error'){ do this//// }else{ do this//// }

Can anyone please help me to understand why my webhook URL is not being triggered after completion of the scanning process???

  • _"Here, I'm replacing the site name with example.com"_ - but the actual value is a publicly reachable URL, yes? You are not trying to use a `localhost` URL or anything else that is only available in your dev environment? – CBroe Mar 25 '22 at 12:52
  • @CBroe I'm using my dev server URL. Not using localhost URL.. I'm editing my question. – Tamalika Kar Mar 25 '22 at 12:56
  • _"but webhook URL is not triggered"_ - and how _exactly_ did you determine that? Have you first of all checked your server access log, to see if you are receiving any request at all? Also, which _type_ of webhook event are you trying to handle at this point? – CBroe Mar 25 '22 at 13:31
  • Hey @TamalikaKar, I guess that this issue is happen as a result of connectivity issue on your end. In order to clarify it, please use an Independent tool, like this https://requestbin.com, to make sure if the webbooks arrived to your request or not. If you see the webhooks, using this tool, its mean that the issue is on your environment. – No1Lives4Ever Mar 27 '22 at 11:45
  • @No1Lives4Ever Thanks for your reply.. I'll verify this today and will reply you back with the new input. – Tamalika Kar Mar 28 '22 at 03:29
  • @CBroe I was checking the URI segment with the 'completed' status.. If find the status then run insert query with completed status.. And if I didn't find the "completed" status from URI segment then un insert query with error status.. But nothing gets inserted in DB after the whole scanning process. – Tamalika Kar Mar 28 '22 at 03:33

0 Answers0