Наконец-то я получил свой ответ и хочу поделиться со всеми вами.
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "http://testurl.org/news_posting?page=1&length=1",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => array(
"Authorization: Bearer $final_token"
),
));
$responses = curl_exec($curl);
$data = json_decode($responses, true);
$total_jobs_posted_pagi = count($data['data']);
$pages_pagi = (ceil($total_jobs_posted_pagi / $select_postnumber));
$pagLink = "<div class='pagination'>";
$prev_page = $pagenumber_pagi-1;
$next_page = $pagenumber_pagi+1;
if ($pagenumber_pagi > 1) { ?>
<a href="<?php echo $site_url; ?>/test3.php?page=<?php echo $prev_page; ?>">
« </a>
<?php }
for ($i=1; $i<=$pages_pagi; $i++) {
$pagLink .= "<a href='$site_url/test3.php?page=".$i."'>".$i."</a>";
};
echo $pagLink . "</div>";
if ($pagenumber_pagi < $pages_pagi) { ?>
<a href="<?php echo $site_url; ?>/test3.php?page=<?php echo $next_page; ?>">
» </a>
<?php }
$pagenumber_pagi = $_GET['page'];
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "http://testurl.org/news_posting?page=$pagenumber_pagi&length=$select_postnumber",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => array(
"Authorization: Bearer $final_token"
),
));
?>