Good evening. How can I extract the value of "csrf_token" from this code on the page:
EDIT: A "}" was missing at the end of string
of%% of%, so the json string was invalid.
<script type="text/javascript">window._sharedData = {"activity_counts":null,"config":{"csrf_token":"WrNBfRGzWkUl4tsZsqm1HfwhDUDKNFts","viewer":null},"supports_es6":true,"country_code":"unknown","language_code":"pt-br","locale":"pt_BR","entry_data":{"LoginAndSignupPage":[{"captcha":{"enabled":false,"key":""},"gdpr_required":false,"tos_version":"row","username_hint":""}]},"gatekeepers":{"ld":true,"seo":true,"seoht":true,"sf":true,"saa":true},"knobs":{"acct:ntb":0,"cb":0,"captcha":0}}
I tried this way, but I did not succeed:
$data = curl_exec($ch);
$json = json_decode($data, true);
echo $json["config"][0]["csrf_token"];