PHP code example of sharpapi / php-hr-related-job-positions

1. Go to this page and download the library: Download sharpapi/php-hr-related-job-positions library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

sharpapi / php-hr-related-job-positions example snippets




harpAPI\HRRelatedPositions\RelatedJobPositionsClient;
use GuzzleHttp\Exception\GuzzleException;

$apiKey = 'your_api_key_here';
$client = new RelatedJobPositionsClient(apiKey: $apiKey);

try {
    $statusUrl = $client->findRelatedJobPositions(
        content: 'Your text content here',
        language: 'English'
    );

    // Optional: Configure polling
    $client->setApiJobStatusPollingInterval(10);
    $client->setApiJobStatusPollingWait(180);

    // Fetch results (polls automatically)
    $result = $client->fetchResults($statusUrl);
    $resultData = $result->getResultJson();

    echo $resultData;
} catch (GuzzleException $e) {
    echo "API error: " . $e->getMessage();
}