Advertisement
Guest User

Untitled

a guest
Jul 24th, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. $curl = curl_init();
  2. curl_setopt_array($curl, array(
  3. CURLOPT_SSL_VERIFYPEER => 0,
  4. CURLOPT_HEADER => 0,
  5. CURLOPT_RETURNTRANSFER => 1,
  6. CURLOPT_URL => $url,
  7. CURLOPT_HTTPHEADER => $headers
  8. ));
  9. if ($method !== 'GET') {
  10. curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $method);
  11. curl_setopt($curl, CURLOPT_POSTFIELDS, $postData);
  12. }
  13.  
  14. $response = curl_exec($curl);
  15. curl_close($curl);
  16.  
  17. $context = null;
  18. if ($method !== 'GET') {
  19.  
  20. $context = stream_context_create(array(
  21. 'http' => array(
  22. 'method' => 'POST',
  23. 'header' => $headers,
  24. 'content' => $postData,
  25. ),
  26. "ssl"=>array(
  27. "allow_self_signed"=>true,
  28. "verify_peer"=>false,
  29. "verify_peer_name"=>false,
  30. ),
  31. ));
  32. }
  33.  
  34.  
  35. // Отправить запрос на себя, чтобы запустить тесты
  36. // и показать результат выполнения тестов
  37. $response = file_get_contents($url, false, $context);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement