Advertisement
Guest User

Untitled

a guest
Oct 25th, 2016
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.06 KB | None | 0 0
  1.  
  2. $myCurl = curl_init();
  3.  
  4. curl_setopt_array($myCurl,array(
  5.     CURLOPT_URL => 'https://stat.rcom.dn.ua',
  6.     CURLOPT_FOLLOWLOCATION => true,
  7.     CURLOPT_SSL_VERIFYPEER => false,
  8.     CURLOPT_SSL_VERIFYHOST => false,
  9.     CURLOPT_RETURNTRANSFER => TRUE,
  10.  
  11.  
  12.     CURLOPT_COOKIEFILE => 'cookie.txt', //Путь к файлику с куками
  13.     CURLOPT_COOKIEJAR => 'cookie.txt', //Путь к файлику с куками
  14.     CURLOPT_POST => true,
  15.    CURLOPT_POSTFIEDS => "login=тутлогин&pass=тутпароль&code=$code"
  16.      ));
  17. $myCurlExec = curl_exec($myCurl);
  18. // Если запрос не удачен
  19. if($myCurlExec != true){die( 'cURL не смог отправить запрос.Код ошибки - '.curl_errno($myCurl).' ,сообщение ошибки - '.curl_error($myCurl) );}
  20.  
  21.  
  22. include ('simple_html_dom.php');
  23. $html = str_get_html("$myCurlExec");
  24. foreach($html->find('input[name=code]') as $element) {
  25.    $input = $element .'<br>'; //
  26. }
  27. $code = preg_replace('/[^0-9]/', '', $input);
  28.     echo $code;
  29. echo $myCurlExec;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement