Open a URL with a PHP within it using cURL

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP



Open a URL with a PHP within it using cURL



I am trying to fetch data from a URL using cURL...this is something I would be able to do but the URL that I want to fetch data from has a section of php code within it - i.e. the URL is populated using a values generated by an earlier section of code.



I want to access the URL, take the figures out of it and then plug those figures into something else. At the minute I am hitting a bit of a roadblock as the php doesn't populate the URL...any ideas?



The code I am using is:


$url = "https://*START OF API ADDRESS*<?php echo $request_ids; ?>*END OF API ADDRESS*";

$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_URL,$url);
$result=curl_exec($ch);
curl_close($ch);

//var_dump(json_decode($result, true));
$rates = json_decode($result, true);

// Save result
$rates['last_updated'] = time();
file_put_contents($file, json_encode($rates));
}





Then it is probably not populated by PHP. The PHP code shoudl run when you cURL to it, but javascript wont run
– RiggsFolly
just now









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Firebase Auth - with Email and Password - Check user already registered

Dynamically update html content plain JS

How to determine optimal route across keyboard