Answer the question
In order to leave comments, you need to log in
Is it possible to set a session via POST?
There is a script:
session_start();
if (!isset($_SESSION['counter'])) {
$_SESSION['counter'] = 0;
}
if ($_SESSION['counter'] > '30') { ####
print 'limit';
exit;
}
print ++$_SESSION['counter'];
$url = 'site.com';
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
$response = curl_exec($ch);
curl_close($ch);
print_r($response);
Answer the question
In order to leave comments, you need to log in
You need to configure curl to work with cookies:
curl_setopt ($ch, CURLOPT_COOKIESESSION, TRUE);
curl_setopt ($ch, CURLOPT_COOKIEFILE, "/tmp/my_php_script_cookie_1.txt");
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question