Advertisement
Guest User

Untitled

a guest
Feb 1st, 2016
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.26 KB | None | 0 0
  1. <?php
  2. /**
  3. *
  4. * @ This file is created by deZender.Net
  5. * @ deZender (PHP5 Decoder for ionCube Loader)
  6. *
  7. * @ Version : 2.0.0.4
  8. * @ Author : DeZender
  9. * @ Release on : 21.10.2015
  10. * @ Official site : http://DeZender.Net
  11. *
  12. */
  13.  
  14. function curl($opt, $ch = null, $is_close = true) {
  15. $headers = array();
  16. $header_function = function ($ch, $header) {
  17. static $headers;
  18. $_header = trim($header);
  19. $colonPos = strpos($_header, ":");
  20. if (0 < $colonPos) {
  21. $name = strtolower(substr($_header, 0, $colonPos));
  22. $val = preg_replace("/^\\W+/", "", substr($_header, $colonPos));
  23. $headers[$name] = $val;
  24. }
  25. return strlen($header);
  26. }
  27. ;
  28. $ch = isset($ch) ? $ch : curl_init();
  29. curl_setopt_array($ch, curl_get_options($opt));
  30. curl_setopt($ch, CURLOPT_HEADERFUNCTION, $header_function);
  31. $content = curl_exec($ch);
  32. $obj = new stdClass();
  33. if (isset($headers["content-type"]) && in_str($headers["content-type"], "application/json")) {
  34. $obj = (object)json_decode($content, false, 512, JSON_BIGINT_AS_STRING);
  35. }
  36. $obj->http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
  37. $obj->http_url = curl_getinfo($ch, CURLINFO_EFFECTIVE_URL);
  38. if (isset($opt["header_out"]) && $opt["header_out"]) {
  39. $obj->http_header_out = curl_getinfo($ch, CURLINFO_HEADER_OUT);
  40. }
  41. if (isset($opt["header"]) && $opt["header"]) {
  42. $obj->http_headers = $headers;
  43. }
  44. if ($is_close) {
  45. curl_close($ch);
  46. }
  47. $obj->content = $content;
  48. return $obj;
  49. }
  50.  
  51. function multi_curl($opts, $callback = null, $rolling_window = 5) {
  52. $mh = curl_multi_init();
  53. $rolling_window = sizeof($opts) < $rolling_window ? sizeof($opts) : $rolling_window;
  54. $result = array();
  55. $keys = array();
  56. $_keys = array();
  57. $i = 0;
  58. $chans = array();
  59. $headers = array();
  60. $header_function = function ($ch, $header) {
  61. static $headers;
  62. $_header = trim($header);
  63. $colonPos = strpos($_header, ":");
  64. if (0 < $colonPos) {
  65. $name = strtolower(substr($_header, 0, $colonPos));
  66. $val = preg_replace("/^\\W+/", "", substr($_header, $colonPos));
  67. $headers[(string)$ch][$name] = $val;
  68. }
  69. return strlen($header);
  70. }
  71. ;
  72. foreach ($opts as $key => $opt) {
  73. if ($i < $rolling_window) {
  74. ......................................................
  75. ...........................
  76. ........
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement