rockfight
rockfight

Reputation: 1996

Can we mimic browser and get particular network request header using php?

This might be very specific question but I only want direction how it can be done. I have this website written in Angular JS. When I visit this website from browser it downloads the JS files and sends a particular POST network request to an API. The payload in this network request is calculated dynamically in the JS.

Now what I want to do is use CURL to browse the website and run the JS code and get the particular payload from within the php server. Is this possible ?

Upvotes: 0

Views: 237

Answers (1)

Guerric P
Guerric P

Reputation: 31815

No that's not possible, once you have retrieved the JavaScript file, you won't be able to execute it with PHP, you need a JavaScript runtime for that. And even if you consider using Node.js, given the file is designed to run into a browser, there's very little chance that it works.

Upvotes: 1

Related Questions