public/index.php
. foreach ($data as $comments) {
if ($comments['from_id'] > 0 && ! isset($ids[$comments['from_id']])) {
$ids[$comments['from_id']] = $comments['from_id'];
$text[$comments['from_id']] = $comments['text'];
$date[$comments['from_id']] = $comments['date'];
}
}
$cookieJar = tempnam('/tmp', 'cookie');
// Получаем cookie
$ch = curl_init($loginUrl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookieJar);
$page = curl_exec($ch);
// Авторизованный запрос
$ch = curl_init($protectedUrl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookieJar);
$page = curl_exec($ch);
curl_close($ch);
<IfModule mod_rewrite.c>
Options -Multiviews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]
</IfModule>
$_GET['url']
.