A
A
Alexander Vasyuchenko2016-01-15 13:42:36
PHP
Alexander Vasyuchenko, 2016-01-15 13:42:36

Is it possible to emulate ajax post with SAMEORIGIN security via CURL in PHP?

For example, here is the page: 37.220.36.15/video/3c6e6f3bf0ebfd19/iframe
It has the following JS code:

$.post('/sessions/create_session', {
    partner: null,
    d_id: 21609,
    video_token: '3c6e6f3bf0ebfd19',
    content_type: 'movie',
    access_key: '0fb74eb4b2c16d45fe',
    cd: condition_detected ? 1 : 0
  }).success(function(video_url) ...

I tried to emulate a request via CURL in PHP, but it always returns an error. There's some kind of protection apparently to be addressed from the same domain (SAMEORIGIN). Is it possible to get around this somehow?
ps I am attaching the headers that chrome sends with this request:
015dc373cdb640f9bdd97a9252714410.png

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Vasyuchenko, 2016-01-18
@alexv1981

Understood. It was all about the X-CSRF-Token and Content-Data headers, which were dynamically generated on the page.

I
Ivan GiBSON, 2016-01-15
@gibson_dev

Add a referer header

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question