Guest User

Untitled

a guest
Aug 11th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. <?php
  2.  
  3. if ($_SERVER['REQUEST_METHOD'] === 'POST')
  4. {
  5. $keyword = $_POST['singleSearchTerm'];
  6. $filename = $_POST['singleFilename'];
  7. $settings = file('settings.txt', FILE_SKIP_EMPTY_LINES);
  8. $conda_path = $settings[0];
  9. $working_env = $settings[1];
  10. $script = "scrape.py";
  11. $url = "https://www.pinterest.com/search/pins/?q=";
  12. $current_dir = getcwd();
  13.  
  14. // cd into path
  15. $cd_path = "cd " . $conda_path . "&& ";
  16.  
  17. // activate env
  18. $activate_env = "activate " . $working_env . " && cd ";
  19.  
  20. // run python script
  21. $pyCommand = $current_dir . "\ps\ " . " && python -W ignore ". $script . " --url " . $url . $keyword . " --fname " . $filename;
  22.  
  23. // full command
  24. $full_command = $cd_path . $activate_env . $pyCommand;
  25.  
  26. echo $full_command;
  27.  
  28. // test - works fine
  29. exec("start notepad.exe");
  30.  
  31. // doesn't do anything
  32. exec($full_command);
  33.  
  34. // doesnt do anything
  35. system($full_command)
  36. }
  37.  
  38. cd C:Usersda74Anaconda3Scripts && activate scrape && cd C:MAMPhtdocspinscraperps && python -W ignore scrape.py --url https://www.pinterest.com/search/pins/?q=old --fname dat.csv
  39.  
  40. exec("start notepad.exe");
Add Comment
Please, Sign In to add comment