PHP.SU

Программирование на PHP, MySQL и другие веб-технологии
PHP.SU Портал     На главную страницу форума Главная     Помощь Помощь     Поиск Поиск     Поиск Яндекс Поиск Яндекс     Вакансии  Пользователи Пользователи

Страниц (1): [1]

> Найдено сообщений: 6
lexus1990 Отправлено: 27 Июля, 2016 - 23:03:39 • Тема: Should be compatible with в php7 • Форум: Объектно-ориентированное программирование

Ответов: 2
Просмотров: 814
Fart пишет:
покажи оригинал классов и их namespace

че то смотрю и в каждой строчке одинаковые имена вижу


Они и есть с одинаковыми именами. Лежат в разных папках с разными неймспейсами. Мне коллеги подсказали, что вероятнее всего php 5 не проверят сигнатуры статических методов
lexus1990 Отправлено: 24 Июля, 2016 - 14:53:15 • Тема: Should be compatible with в php7 • Форум: Объектно-ориентированное программирование

Ответов: 2
Просмотров: 814
Кто-нибудь знает почему php 5 пропускал следующую конструкцию:

PHP:
скопировать код в буфер обмена
  1.  
  2. namespace common\auth;
  3.  
  4. class OAuthClient extends \OAuthClient
  5. {
  6. public static function makeResourceRequest(OAuthClientState $cs, $request_url, $post_params) {}
  7. }


PHP:
скопировать код в буфер обмена
  1. class OAuthClient
  2. {
  3. public static function makeResourceRequest(OAuthClientState $cs, $request_url, $post_params) {}
  4. }


PHP:
скопировать код в буфер обмена
  1. namespace common\auth;
  2.  
  3. class OAuthClientState extends \OAuthClientState{}



А php 7 нет, и ругается на makeResourceRequest should be compatible with makeResourceRequest() из родительского класса.
При этом класс OAuthClientState из namespace common\auth extends от \OAuthClientState;
Получается что я не могу в extends OAuthClient ужесточить требование к OAuthClientState и принимать только определенный его extends?
lexus1990 Отправлено: 14 Августа, 2012 - 20:02:35 • Тема: Автоматическая авторизация curl, Не могу авторизоваться на rbkmoney • Форум: Напишите за меня, пожалуйста

Ответов: 0
Просмотров: 32
PHP:
скопировать код в буфер обмена
  1. $strUrl = "https://rbkmoney.ru/index.aspx";
  2. $arrParams = array(
  3.         'ctl00$loginCommon$loginTextBox' => 'lexey2006.90@rambler.ru',
  4.         'ctl00$loginCommon$passwordTextBox' => '123456789',
  5.         'ctl00$loginCommon$buttonEnter' => 'Войти',
  6.         '__EVENTTARGET' => '',
  7.         '__EVENTARGUMENT' => '',
  8.         'ctl00$ContentPlaceHolder$bb' => '',
  9. );
  10.  
  11. $ch = curl_init();
  12. curl_setopt($ch, CURLOPT_URL, $strUrl);
  13. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  14. curl_setopt($ch, CURLOPT_FAILONERROR,    1);
  15. curl_setopt($ch, CURLOPT_HEADER,         0);
  16. curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
  17. curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 6.1; rv:12.0) Gecko/20100101 Firefox/12.0");
  18.  
  19. curl_setopt($ch, CURLOPT_POST, true);
  20. curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($arrParams));
  21.  
  22. curl_setopt($ch, CURLOPT_COOKIEJAR, $_SERVER['DOCUMENT_ROOT']."\cookie.txt");
  23. curl_setopt($ch, CURLOPT_COOKIEFILE, $_SERVER['DOCUMENT_ROOT']."\cookie.txt");
  24.  
  25. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
  26. curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
  27.  
  28.  
  29. $result = curl_exec($ch);
lexus1990 Отправлено: 28 Сентября, 2011 - 13:34:02 • Тема: CURL проблемы с авторизацией • Форум: PEAR и PECL

Ответов: 0
Просмотров: 2571
Опишу суть проблемы. Авторизуюсь на сайте первым запросом, проверяю по ob_get_contents - авторизовался. Далее нужно отправить POST запрос. Но в выдаче ob_get_contents - страница с просьбой авторизоваться. Куки сохраняются в файл - проверял. Для безопасности сменил пароль и логин. Если будет желание помочь - кину пароль с логином в личку. Сохранял логи и делал через har2php.sharecoder.com - создает php на основе логов. Чувствую, что ошибка где-то в нескольких заголовках. Заранее огромное спасибо!!! Вот как код:
PHP:
скопировать код в буфер обмена
  1.  
  2. $cookie_file = $_SERVER['DOCUMENT_ROOT'].'/offers/cookies_teztour.txt';
  3. $ch = curl_init();
  4. $teztour_login="LOGIN";
  5. $teztour_passwd="PASS";
  6. $host = "online.teztour.com";
  7. $url = "/UserServer/login.htm";
  8.        
  9. curl_setopt($ch, CURLOPT_URL, 'http://'.$host.$url);
  10. curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.1; rv:6.0.2) Gecko/20100101 Firefox/6.0.2');
  11. curl_setopt($ch, CURLOPT_REFERER, 'http://online.teztour.com/UserServer/index.htm?ref=http%3A%2F%2Fonline.teztour.com%2Farmmanager%2F');
  12. curl_setopt($ch, CURLOPT_ENCODING, 'gzip, deflate');
  13. сurl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file);
  14. curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file);
  15.  
  16. $header = array();
  17. $header[] = 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8';
  18. $header[] = 'Accept-Charset: windows-1251,utf-8;q=0.7,*;q=0.7';
  19. $header[] = 'Accept-Language: ru-ru,ru;q=0.8,en-us;q=0.5,en;q=0.3';
  20. $header[] = 'Pragma: ';
  21. curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
  22. curl_setopt($ch, CURLOPT_POST, true);
  23.  
  24. $fields = array();
  25. $fields[] = 'j_password='.$teztour_passwd;
  26. $fields[] = 'j_username='.$teztour_login;
  27. $fields[] = 'ref=http://online.teztour.com/armmanager/';
  28. $fields[] = 'submit=Войти / Sign in';
  29.  
  30. curl_setopt($ch, CURLOPT_POSTFIELDS, implode('&', $fields));
  31. curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
  32. curl_setopt($ch, CURLOPT_AUTOREFERER, true);
  33. curl_setopt($ch, CURLOPT_HEADER, 1);
  34. $result = curl_exec($ch);
  35. $html_result = iconv('UTF-8', 'windows-1251', ob_get_contents());
  36.  
  37. var_dump($html_result);
  38.  
  39. curl_setopt($ch, CURLOPT_URL, 'http://online.teztour.com/armmanager/workplace/search/getResult');
  40. curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.1; rv:6.0.2) Gecko/20100101 Firefox/6.0.2');
  41. curl_setopt($ch, CURLOPT_REFERER, 'http://online.teztour.com/armmanager/workplace/section/tour-search');
  42. curl_setopt($ch, CURLOPT_ENCODING, 'gzip, deflate');
  43. curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file);
  44. curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file);
  45. curl_setopt($ch, CURLOPT_HEADER, 0);
  46. curl_setopt($ch, CURLOPT_POST, true);
  47.  
  48. $fields = array();
  49. $fields[] = 'accommodationId='.$price['room'];
  50. $fields[] = 'after='.$price['depature_date'];
  51. $fields[] = 'before='.$price['depature_date'];
  52. $fields[] = 'cityId='.$price['city_from'];
  53. $fields[] = 'countryId='.$price['country'];
  54. $fields[] = 'currency='.$price['currency'];
  55. $fields[] = 'hotelClassBetter=true';
  56. $fields[] = 'hotelClassId=2567';
  57. $fields[] = 'hotelId='.$price['hotel'];
  58. $fields[] = 'hotelInStop=true';
  59. $fields[] = 'locale=ru';
  60. $fields[] = 'nightsMax='.$price['days'];
  61. $fields[] = 'nightsMin='.$price['days'];
  62. $fields[] = 'noTicketsFrom=false';
  63. $fields[] = 'noTicketsTo=false';
  64. $fields[] = 'priceMax='.$price['price'];
  65. $fields[] = 'priceMin='.$price['price'];
  66. $fields[] = 'rAndBBetter=true';
  67. $fields[] = 'rAndBId=15350';
  68. $fields[] = 'specialInStop=undefined';
  69. $fields[] = 'tourId='.$price['city_to'];
  70. $fields[] = 'tourType=1';
  71. $fields[] = 'version=2';
  72.        
  73. curl_setopt($ch, CURLOPT_POSTFIELDS, implode('&', $fields));
  74. curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
  75. curl_setopt($ch, CURLOPT_AUTOREFERER, true);
  76. $result = curl_exec($ch);
  77. $html_result = iconv('UTF-8', 'windows-1251', ob_get_contents());
  78. var_dump($html_result);
  79.  
lexus1990 Отправлено: 25 Августа, 2011 - 08:04:58 • Тема: Отличие запросе через браузер и через file_get_contents • Форум: Работа с сетью

Ответов: 4
Просмотров: 2058
Как отследить заголовки, которые отсылает браузер? Видимо если разница в заголовках - через curl надо запрос отправлять?
lexus1990 Отправлено: 23 Августа, 2011 - 16:16:37 • Тема: Отличие запросе через браузер и через file_get_contents • Форум: Работа с сетью

Ответов: 4
Просмотров: 2058
Добрый день! Существует обмен через xml шлюз. У системы, откуда присылается xml есть способ запроса - асинхронный. Сначала отсылается запрос вида site.ru?country=111&async=1. Приходит ответ с id сессии nnn.
Далее посылается запрос вида site.ru?country=111&session=nnn, на что приходит пустой xml
PHP:
скопировать код в буфер обмена
  1. <?xml version="1.0" encoding="UTF-8"?><?/xml?>

- т.е. система отвечает. В случае, когда авторизация не пройдена - приходит ответ.
Далее делается тот же самый запрос через браузер - и чудо - в ответе необходимые данные. Какая между этими двумя способами разница?
PHP:
скопировать код в буфер обмена
  1.  
  2.     ob_start();
  3.     $str = $host.$url;
  4.     $result = file_get_contents($str);
  5.     ob_end_clean();
  6.     var_dump($result,$str);
  7.     $session = simplexml_load_string($result);
  8.     $id_session = (string) $session['session'];
  9.     $url = substr($url,0,strpos($url,"async=1")-1);
  10.     $url .= "&Session=".$id_session."&paging=on&page=1";
  11.        
  12.     ob_start();
  13.     $str = $host.$url;
  14.     $result = file_get_contents($str);
  15.     ob_end_clean();
  16.     var_dump($result, $str);

Страниц (1): [1]
Powered by PHP  Powered By MySQL  Powered by Nginx  Valid CSS  RSS

 
Powered by ExBB FM 1.0 RC1. InvisionExBB