LordVader4606 Posted September 17, 2020 Share Posted September 17, 2020 Alright, so I play a browser game called Politics and War. I run an alliance that has 74 members. In that alliance we offer a bank service for all our members, but I - being the leader - am the only one who can access the bank. I have been building a site that works with the game API to gather data for members and create a dashboard. One of the features I am trying to build is allowing them to withdraw from their account instantly. So, what I need: To be able to submit a POST request to login to the site (specifically on this page --> https://politicsandwar.com/login) with my username and password, but then I need to keep the session active and navigate to a different page (the alliance bank page). On that page I first need to scrape a value from a hidden input (token) and then I need to submit a POST request to this same page while still being logged in. I am not asking someone to do it for me, but rather someone to help me know how to go about this. I have never submitted post requests with PHP, but I have used PHP cURL in the past. I also have made POST requests with JS, but never PHP. Thank you so much for anyone that is able to help! Quote Link to comment https://forums.phpfreaks.com/topic/311496-how-to-login-to-a-page-scrape-a-value-and-then-submit-a-post-form/ Share on other sites More sharing options...
kicken Posted September 17, 2020 Share Posted September 17, 2020 You can use curl or the Guzzle library to handle making your web requests and maintaining the session. Just read the respective documentation to see how it's done, neither is very hard. Once you get the HTML you can use the DOM library to parse it and extract the information you need. Quote Link to comment https://forums.phpfreaks.com/topic/311496-how-to-login-to-a-page-scrape-a-value-and-then-submit-a-post-form/#findComment-1581442 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.