Antichat снова доступен.
Форум Antichat (Античат) возвращается и снова открыт для пользователей.
Здесь обсуждаются безопасность, программирование, технологии и многое другое.
Сообщество снова собирается вместе.
Новый адрес: forum.antichat.xyz
 |
|

19.02.2010, 15:06
|
|
Постоянный
Регистрация: 16.04.2008
Сообщений: 889
Провел на форуме: 12942062
Репутация:
1550
|
|
Установить curl
|
|
|

19.02.2010, 16:29
|
|
Новичок
Регистрация: 11.01.2010
Сообщений: 10
Провел на форуме: 13024
Репутация:
0
|
|
Как ??? Можно поподробне ???
А еще лутше если вы подскажите на каком freeхосте это можно сделать ???
|
|
|

19.02.2010, 17:31
|
|
Новичок
Регистрация: 10.01.2007
Сообщений: 16
Провел на форуме: 109680
Репутация:
2
|
|
Есть код определения ПР:
PHP код:
<?php
error_reporting (E_ALL & ~E_NOTICE);
/**
* Google Page rank data grabber.
* Based on Google toolbar data.
*
* Working with data like that:
* "Rank_1:1:6". Without XML/HTML parsing.
*
* @important:
* This code is for cognitive purposes only.
* Usage of this code is against Google's terms of service.
* No support is provided for this code.
* Can be used "as is" for your own risk.
*
* @requirements:
* - PHP version 5 (can easily be downgraded to PHP4)
* - cURL library (but you can replace curl functions with
* PHP standard fopen/fread or other)
*
* @version 1.1
* @author exstabler // PHP version
* @author snoopy // JS version
*
* @changelog:
* - 2007-01-18:
* 1. [exstabler] Deprecated method intToHex deleted.
* 2. [exstabler] Method toHex8 corrected.
*
* @sample usage:
* $obj = new PageRankGrabber();
* $rank = $obj->getRank('http://dir.org.ru');
*/
class PageRankGrabber {
/**
* Returns PageRank for specified page
* @param string $url
* @return integer PageRank value
*/
public function getRank($url) {
$pageUrl = $this->getRankUrlStingByPageUrl($url);
$content = $this->getContentCurl($pageUrl);
echo $pageUrl;
$parts = explode(":", $content);
return intval(@$parts[count($parts)-1]);
}
/**
* Returns content by URL with using
* cURL library.
*
* @param string $url
* @return string Site content
*/
public function getContentCurl($url) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
$result = curl_exec($ch);
curl_close($ch);
return $result;
}
/**
* Returning URL where PR can be grabbed.
*
* @param string $page - Page URL
* @return string
*/
public function getRankUrlStingByPageUrl($page) {
$this->awesomeHash($page);
$hash = "8" . $this->awesomeHash($page);
$url = "http://toolbarqueries.google.com/search?sourceid=" .
"navclient-ff&features=Rank&client=navclient-auto-ff&";
$url .= "ch=" . $hash . "&q=info:" . urlencode($page);
return str_replace(' ', '', $url);
}
/**
* Transforms integer into hexademical
*
* @param int $num
* @return string
*/
private function toHex8($num) {
$vector = "0123456789abcdef";
return $vector[($num % 256) / 16] . $vector[$num % 16];
}
/**
* Service function: encoder
*/
private function hexEncodeU32($num) {
$result = $this->toHex8($this->zerofillShift($num, 24));
$result .= $this->toHex8($this->zerofillShift($num, 16) & 255);
$result .= $this->toHex8($this->zerofillShift($num, 8) & 255);
return $result . $this->toHex8($num & 255);
}
/**
* Service function: hashing
*/
private function awesomeHash($value) {
$hashSeed = "Mining PageRank is AGAINST GOOGLE'S TERMS OF SERVICE." .
"Yes, I'm talking to you, scammer.";
$intValue = 16909125;
for($i = 0; $i < strlen($value); $i++ ){
$intValue ^=
$this->charCodeAt($hashSeed, $i % strlen($hashSeed)) ^
$this->charCodeAt($value, $i);
$intValue =
$this->zerofillShift($intValue, 23) | $intValue << 9;
}
return $this->hexEncodeU32($intValue);
}
/**
* The charCodeAt() method returns the Unicode
* of the character at a specified position.
*
* @param int $value
*/
private function charCodeAt($value, $position) {
$symbol = $value[$position];
// ord() is for ASCII!
// Original function should work with UTF-8.
return ord($symbol);
}
/**
* Service function: zerofil with shifing
* (unsigned shift right).
*/
private function zerofillShift($a, $b) {
$z = hexdec(80000000);
if ($z & $a) {
$a = ($a >> 1);
$a &= (~$z);
$a |= 0x40000000;
$a = ($a >> ($b-1));
} else {
$a = ($a >> $b);
}
return $a;
}
}
$obj = new PageRankGrabber();
$rank = $obj->getRank('http://google.com');
echo " hello ".$rank."<br>";
phpinfo();
?>
Один и тот же код на разных серверах.
На всех серверах кроме одного выполняется корректно, хеш считает: http://toolbarqueries.google.com/search?sourceid=navclient-ff&features=Rank&client=navclient-auto-ff&ch= 8183b0d79&q=info:http%3A%2F%2Fgoogle.com
А на нужном выдает ошибку:
Код:
PHP Notice: Uninitialized string offset: -1 in /var/www/html/prcheck/index3.php on line 89
и ничего не считает: http://toolbarqueries.google.com/search?sourceid=navclient-ff&features=Rank&client=navclient-auto-ff&ch= 80ffffff&q=info:http%3A%2F%2Fgoogle.com
Уже несколько раз пересобирал пхп, включал-отключал модули. Хоть убейся не могу найти зависимость.
Огромная просьба помочь, может у кого есть идеи.
|
|
|

19.02.2010, 17:31
|
|
Участник форума
Регистрация: 31.01.2010
Сообщений: 170
Провел на форуме: 1442841
Репутация:
63
|
|
денвер найдешь где скачать,а тут написано про установку курла на него http://parsing-and-i.blogspot.com/2009/09/curl-denwer.html
|
|
|

19.02.2010, 22:07
|
|
Познающий
Регистрация: 22.03.2007
Сообщений: 45
Провел на форуме: 110666
Репутация:
9
|
|
Мне нужно вывести предложение изходя из времени.
К примеру:
с 9:00 по 10:35 - вывод: Доброе утро
с 12:50 по 14:25 - вывод: Добрый день
с 16:20 по 17:55 - вывод: Добрый вечер
Как это реализовать в php? Есть ли стндартные функции? Если нет, то где искать решение?
ЗЫ: Ответа не нашел, видимо не нашелся как сформировать поисковый запрос.. уж сложно в отношении данного вопроса
|
|
|

19.02.2010, 22:16
|
|
Постоянный
Регистрация: 08.11.2008
Сообщений: 498
Провел на форуме: 2603363
Репутация:
278
|
|
Сообщение от real_kas
Мне нужно вывести предложение изходя из времени.
К примеру:
с 9:00 по 10:35 - вывод: Доброе утро
с 12:50 по 14:25 - вывод: Добрый день
с 16:20 по 17:55 - вывод: Добрый вечер
Как это реализовать в php? Есть ли стндартные функции? Если нет, то где искать решение?
ЗЫ: Ответа не нашел, видимо не нашелся как сформировать поисковый запрос.. уж сложно в отношении данного вопроса
PHP код:
$date = date("Hi");
if( $date >= 0900 && $date <= 1035 ) echo "Доброе утро";
if( $date >= 1250 && $date <= 1425 ) echo "Добрый день";
if( $date >= 1620 && $date <= 1735 ) echo "Добрый вечер";
|
|
|

19.02.2010, 22:35
|
|
Участник форума
Регистрация: 21.02.2008
Сообщений: 255
Провел на форуме: 975514
Репутация:
177
|
|
Сообщение от Deathdreams
PHP код:
if( $date >= 0900 && $date <= 1035 ) echo "Доброе утро";
0900 == 0
|
|
|

19.02.2010, 22:35
|
|
Познающий
Регистрация: 22.03.2007
Сообщений: 45
Провел на форуме: 110666
Репутация:
9
|
|
Сообщение от imajo.ati
0900 == 0
почему?
|
|
|

20.02.2010, 16:09
|
|
Участник форума
Регистрация: 27.12.2009
Сообщений: 126
Провел на форуме: 1170081
Репутация:
63
|
|
что за ошибка
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/realbn/domains/*****/public_html/parser/parser2.php:6) in /home/realbn/domains/*****/public_html/parser/parser2.php on line 7???
|
|
|

20.02.2010, 16:23
|
|
Участник форума
Регистрация: 20.01.2008
Сообщений: 284
Провел на форуме: 3767223
Репутация:
408
|
|
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/realbn/domains/*****/public_html/parser/parser2.php:6) in /home/realbn/domains/*****/public_html/parser/parser2.php on line 7???
Видимо есть пробелы\пустые строки в <?php там ничего не должно быть...
Подробнее тут http://joomlaforum.ru/index.php?topic=34534.0
|
|
|
|
 |
|
|
Здесь присутствуют: 1 (пользователей: 0 , гостей: 1)
|
|
|
|