This example is written for educational purposes in order to show how to work with cookies with Guzzle client.
The site is selected and from it we will parse the code for registration.
But when requesting the site, we will come across a problem that the site does not return content, but will return the js code with function which set cookies.
<html>
<body onload="antidos()">
<script>
function antidos() { document.cookie="EWAAD=1c3580445beef1431db8353bd406009c;
path=/";document.location.href="https://www.mzv.cz/lvov/uk/x2004_02_03/x2016_05_18/x2017_11_24_1.html";}
</script>
<div align="center">
<noscript>EWA CDN (D)DoS protection.
Please, enable javascript and cookies to continue.</noscript></div>
</body>
</html>
We will have such an algorithm for actions:
- Request to receive js content
- Parsing js content
- Setting up cookies for Guzzle client
- Request for page content
- Content parsing and the getting of the registration code
This is simple php application and for install run:
composer install
When you have installed the package dependencies with composer you may open application in browser.
This project is licensed under the MIT License - see the LICENSE file for details