Guest User

Untitled

a guest
Jul 1st, 2016
40
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.64 KB | None | 0 0
  1. $k = microtime(1);
  2. $url = "http://www.part-kom.ru/engine/api/v2/search/parts";
  3. $array =  json_decode('{"number":"4PK875","brand_id":"710","find_substitutes":0,"store":0}');
  4. $username = "eezap.ru";
  5. $password = "**********"; //наш пароль
  6. $url .= "?" . http_build_query($array);
  7. $ch = curl_init();
  8. curl_setopt($ch, CURLOPT_URL, $url);
  9. curl_setopt($ch, CURLOPT_TIMEOUT, 30); //timeout after 30 seconds
  10. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  11. curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
  12. curl_setopt($ch, CURLOPT_USERPWD, "$username:$password");
  13. $result = curl_exec($ch);
  14. curl_close($ch);
  15. echo microtime(1)-$k; // 9 секунд
Add Comment
Please, Sign In to add comment