Guest User

Untitled

a guest
Oct 23rd, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. $ch = curl_init();
  2.  
  3. curl_setopt($ch, CURLOPT_URL, "http://www.mywebsite1.com/myfavoritestreams");
  4. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  5. curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
  6.  
  7.  
  8. $headers = array();
  9. $headers[] = "Host: www.wiz1.net";
  10. $headers[] = "Connection: keep-alive";
  11. $headers[] = "Upgrade-Insecure-Requests: 1";
  12. $headers[] = "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36";
  13. $headers[] = "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8";
  14. $headers[] = "Referer: http://www.mywebsite1.com";
  15. $headers[] = "Accept-Encoding: gzip, deflate";
  16. $headers[] = "Accept-Language: en-US,en;q=0.9";
  17. $headers[] = "Cookie: __cfduid=d00d780044d6524dab736999f38359bba1534699518; _ga=GA1.2.1974576514.1534699525; _gid=GA1.2.795232845.1540262479";
  18. curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
  19.  
  20. $filename = curl_exec($ch);
  21. if (curl_errno($ch)) {
  22. echo 'Error:' . curl_error($ch);
  23. }
  24. curl_close ($ch);
  25. $string_to_replace="mywebsite1";
  26. $replace_with="mywebsite2";
  27. replace_string_in_file($filename, $string_to_replace, $replace_with);
  28.  
  29. function replace_string_in_file($filename, $string_to_replace, $replace_with){
  30. $content=file_get_contents($filename);
  31. $content_chunks=explode($string_to_replace, $content);
  32. $content=implode($replace_with, $content_chunks);
  33. file_put_contents($filename, $content);
  34. }
Add Comment
Please, Sign In to add comment