Advertisement
Guest User

Untitled

a guest
Jul 20th, 2017
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.34 KB | None | 0 0
  1. <?php
  2.  
  3. $cookies = "cookie.txt"; // Make sure the file is created and had read/wright
  4. $ch = curl_init();
  5.  
  6. $headers = array();
  7. $headers[] = 'Host: example.com';
  8. $headers[] = 'origin: http://example.com';
  9. $headers[] = 'authority: example.com';
  10. $headers[] = 'User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.71 Safari/537.36';
  11. $headers[] = 'Accept: */*';
  12. $headers[] = 'Accept-Language: fr,fr-FR;q=0.8,en-US;q=0.5,en;q=0.3';
  13. $headers[] = 'Accept-Encoding: gzip, deflate';
  14. $headers[] = 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8';
  15. $headers[] = 'X-Requested-With: XMLHttpRequest';
  16. $headers[] = 'Connection: keep-alive';
  17.  
  18. // we switch to new device
  19. $url = "http://example.com";
  20. $post_params = "user=hello&password=world";
  21. curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
  22. curl_setopt($ch, CURLOPT_POSTFIELDS, $post_params);
  23. curl_setopt($ch, CURLOPT_URL, $url);
  24. curl_setopt($ch, CURLOPT_REFERER, $url);
  25. curl_setopt($ch, CURLOPT_COOKIESESSION, true);
  26. curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false);
  27. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  28. curl_setopt($ch, CURLOPT_COOKIEFILE, $cookies);
  29. curl_setopt($ch, CURLOPT_COOKIEJAR, $cookies);
  30. curl_setopt($ch, CURLOPT_COOKIE, $cookies);
  31. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  32. $dashboard = curl_exec($ch); // Will return the HTML od the page
  33.  
  34. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement