Advertisement
Guest User

Untitled

a guest
May 3rd, 2016
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. function _isCurl() {
  2. return function_exists('curl_version');
  3. }
  4.  
  5. $ch = curl_init("URL_PARA_CONECTAR");
  6. curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
  7. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
  8. ...
  9.  
  10. ...
  11. $data = curl_exec($ch);
  12. $response = json_decode($data, true); // o true indica que você quer o resultado como array
  13.  
  14. $valoresParaSubmeter = array('key1' => 'valor1', 'key2' => 'valor2');
  15. $ch = curl_init("URL_PARA_CONECTAR");
  16.  
  17. curl_setopt($ch, CURLOPT_FOLLOWLOCATION, FALSE);
  18. curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
  19. curl_setopt($ch, CURLOPT_POST, 1);
  20. curl_setopt($ch, CURLOPT_POSTFIELDS, $valoresParaSubmeter);
  21. curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
  22. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
  23. $data = curl_exec($ch);
  24. $response = json_decode($data, true); // o true indica que você quer o resultado como array
  25.  
  26. var_dump($response);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement