A bot works excatly like a browser. Since the only information that your web server sends off is the HTML the bot has to read that HTML.
Your Web Server will parse and run your PHP code to generate the HTML that gets sent to the bot, which will read the HTML and catalog it's information.