POST / HTTP/1.1
User-Agent: Mozilla/4.0 (Windows; U; Windows NT 5.0; En; rv:1.8.0.2) Gecko/20070306 Firefox/1.0.0.4
Host: yanadex.ru
Accept: application/json, text/javascript, */*; q=0.01
Accept-Language: ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
X-Requested-With: XMLHttpRequest
Connection: keep-alive
Pragma: no-cache
Cache-Control: no-cache
Content-Length: 15
POST / HTTP/1.1
User-Agent: Mozilla/4.0 (Windows; U; Windows NT 5.0; En; rv:1.8.0.2) Gecko/20070306 Firefox/1.0.0.4
Host: yanadex.ru
Cookie: sid=9e7d57af7e81fdf0dfedb441712970d3
Accept: application/json, text/javascript, */*; q=0.01
Accept-Language: ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
X-Requested-With: XMLHttpRequest
Connection: keep-alive
Pragma: no-cache
Cache-Control: no-cache
Content-Length: 15
curl_setopt($ch, CURLOPT_COOKIEFILE, __DIR__ .'/cookie1.txt');
curl_setopt($ch, CURLOPT_COOKIEJAR, __DIR__.'/cookie1.txt');
curl_setopt($ch, CURLOPT_COOKIE, $_SERVER['DOCUMENT_ROOT'].'/cookie1.txt');
function mergeAfterSort($left, $right)
{
$result = [];
$rightIndex = 0;
$leftIndex = 0;
$cLeft = count($left);
$cRight = count($right);
while ($leftIndex < $cLeft && $rightIndex < $cRight) {
if ($left[$leftIndex] < $right[$rightIndex]) {
$result[] = $left[$leftIndex];
$leftIndex++;
} else {
$result[] = $right[$rightIndex];
$rightIndex++;
}
}
for (; $leftIndex < $cLeft; $leftIndex++) {
$result[] = $left[$leftIndex];
}
for (; $rightIndex < $cRight; $rightIndex++) {
$result[] = $right[$rightIndex];
}
return $result;
}
function mergeSort(Array $arr)
{
$count = count($arr);
if ($count < 2.) {
return $arr;
} else {
$mIndex = ceil($count / 2.);
return mergeAfterSort(mergeSort(array_slice($arr, 0, $mIndex)), mergeSort(array_slice($arr, $mIndex)));
}
}
function mergeAfterSort(Array $left, Array $right)
{
$result = [];
while (($cLeft = count($left)) | ($cRight = count($right))) {
if (!$cLeft) {
$result = array_merge($result, $right);
break;
}
if (!$cRight) {
$result = array_merge($result, $left);
break;
}
if ($left[0] < $right[0]) {
$result[] = array_shift($left);
} else {
$result[] = array_shift($right);
}
}
return $result;
}
arr.sort(function (a, b) {
var aa = a + 5;
if (aa > b) {
return -1;
}
if (aa < b) {
return 1;
}
return 0;
});
Так что самый дельным советом будет, пойти и подучить сам язык и его возможности, а попутно прихватить немного HTML