how to scrape ajax page using php

ساخت وبلاگ
سلام.
برای scrape کردن سایت هایی که محتوایات صفحه با ajax لود می شود ، مشکل دارم. ابتدا سایت رو Inspect می کنم و برای XHR فیلتر می کنم. پارامتر ها هم مشخص است. ولی وقتی scrape می کنم محتویات صفحه یک با مثلا 5 برابر است.
لطفا راهنمایی
function curlPost($postUrl, $postFields) {

$ch = curl_init(); // Initialising cURL session
// Setting cURL options
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); // Prevent cURL from verifying SSL certificate
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); // method
curl_setopt($ch, CURLOPT_FAILONERROR, TRUE); // Script should fail silently on error
// curl_setopt($ch, CURLOPT_COOKIESESSION, TRUE); // Use cookies
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE); // Follow Location: headers
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); // Returning transfer as a string
curl_setopt($ch, CURLOPT_URL, $postUrl);
curl_setopt($ch, CURLOPT_HTTPHEADER, array("X-Requested-With: XMLHttpRequest", "Content-Type: text/html; charset=UTF-8")); // Setting URL to POST to
curl_setopt($ch, CURLOPT_POST, TRUE); // Setting method as POST
curl_setopt($ch, CURLOPT_POSTFIELDS, $postFields); // Setting POST fields as array

$results = curl_exec($ch); // Executing cURL session
curl_close($ch); // Closing cURL session

return $results;
}

$url = 'https://www.ottawatourism.ca/events/'; // Login POST URL

// Array built from login credentials
$credentials = array(
'action' => 'events_see_more', // Your email address
'security' => 'a5db027292', // Your password
'page' => '5'
);

$request = curlPost($url, $credentials);
var_dump($request);

php مرکز کد های سایت...
ما را در سایت php مرکز کد های سایت دنبال می کنید

برچسب : how to scrape a website,how to scrape paint,how to scrape a bowl,how to scrape popcorn ceiling,how to scrape vanilla bean,how to scrape resin,how to scrape a pipe,how to scrape paint off a house,how to scrape tongue,how to scrape a website python, نویسنده : استخدام کار phpco بازدید : 149 تاريخ : دوشنبه 1 شهريور 1395 ساعت: 2:49