JSearch

FREEMIUM
Verified
By OpenWeb Ninja | Updated il y a 2 jours | Jobs
Popularity

9.9 / 10

Latency

1,754ms

Service Level

100%

Health Check

100%

Back to All Discussions

Detailed Job Page

Rapid account: Partharonisaha
partharonisaha
il y a 2 mois

How to create detailed job page with job_id?

<?php

if(isset($_GET[‘job_id’])) {
$job_id = $_GET[‘job_id’];

$curl = curl_init();

curl_setopt_array($curl, [
    CURLOPT_URL => "https://jsearch.p.rapidapi.com/job?id=$job_id",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => "",
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 30,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => "GET",
    CURLOPT_HTTPHEADER => [
        "X-RapidAPI-Host: jsearch.p.rapidapi.com",
        "X-RapidAPI-Key: <API KEY>"
    ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
    echo "cURL Error #:" . $err;
} else {
    $job = json_decode($response, true);
    if (empty($job)) {
        echo "No job found for ID: $job_id";
    } else {
        echo "<h2>{$job['title']}</h2>";
        echo "<p><strong>Employer Name:</strong> {$job['employer_name']}</p>";
        if (!empty($job['employer_logo'])) {
            echo "<img src='{$job['employer_logo']}' alt='Employer Logo'>";
        }
        echo "<p><strong>Employer Website:</strong> <a href='{$job['employer_website']}' target='_blank'>{$job['employer_website']}</a></p>";
        echo "<p><strong>Employer Company Type:</strong> {$job['employer_company_type']}</p>";
        echo "<p><strong>Job Publisher:</strong> {$job['job_publisher']}</p>";
        echo "<p><strong>Job Apply Link:</strong> <a href='{$job['job_apply_link']}' target='_blank'>Apply</a></p>";
        echo "<p><strong>Job Apply Directly:</strong> {$job['job_apply_is_direct']}</p>";
        // Add more job details as needed
    }
}

} else {
echo “No job ID provided.”;
}

?>

Rapid account: Letscrape 6 B R Ba 3 Qgu O 5
letscrape-6bRBa3QguO5 Commented il y a 2 mois

Hi there,

Thanks for your message.

Does this PHP page require fixing or is it a working page for others as a reference?

Thank you,
Adam @ OpenWeb Ninja

Join in the discussion - add comment below:

Login / Signup to post new comments