Advertisement
Guest User

Untitled

a guest
Jan 18th, 2018
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. <?php
  2.  
  3. $codigoRastreio = urlencode($_GET['cod']);
  4. $post = array('Objetos' => $codigoRastreio);
  5. // iniciar CURL
  6. $ch = curl_init();
  7. // informar URL e outras funções ao CURL
  8. curl_setopt($ch, CURLOPT_URL, "http://www2.correios.com.br/sistemas/rastreamento/resultado_semcontent.cfm");
  9. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  10. curl_setopt($ch,CURLOPT_POSTFIELDS, http_build_query($post));
  11. // Acessar a URL e retornar a saída
  12. $output = curl_exec($ch);
  13. // liberar
  14. curl_close($ch);
  15. // Imprimir a saída
  16. echo $output;
  17.  
  18. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement