Advertisement
Guest User

Client (logs in to server)

a guest
Aug 27th, 2016
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. <?
  2. function Post($url, $post){
  3.  
  4. $fields_string = '';
  5. foreach($post as $key=>$value) { $fields_string .= $key.'='.$value.'&'; }
  6. rtrim($fields_string, '&');
  7.  
  8. $curl_handle=curl_init();
  9. curl_setopt($curl_handle, CURLOPT_URL,$url);
  10. curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 2);
  11. curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);
  12. curl_setopt($curl_handle, CURLOPT_POST, count($post));
  13. curl_setopt($curl_handle, CURLOPT_POSTFIELDS, $fields_string);
  14. curl_setopt($curl_handle, CURLOPT_USERAGENT, 'Office');
  15. $query = curl_exec($curl_handle);
  16. curl_close($curl_handle);
  17.  
  18. return $query;
  19. }
  20.  
  21. $Logged = Post("http://(ip of main server)/php/login.php", array('Username' => 'FileUpload','Password' => 'Xc1Kl0X9lkI^sqweszxcaSjkhdSJKhdkajshDskaKsjdHDh'));
  22. if ($Logged == 'Log'){
  23. echo "Sending data... <br>";
  24. $UPLD = Post("http://(ip of main server)/Transfer.php", array('timestamp' => time()));
  25. echo $UPLD;
  26. }else{
  27. echo "CURL ERROR";
  28. }
  29. ?>
  30.  
  31. <!doctype html>
  32. <html>
  33. <head>
  34. <meta charset="UTF-8">
  35. <title>Test</title>
  36. </head>
  37.  
  38. <body>
  39.  
  40. </body>
  41. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement