XF 2.2 PHP in a Page Node

Digital Jedi

Well-known member
I've always been a little slow on PHP related stuff, but if I'm understanding this correctly, you can't put the PHP code in the template, right? You have to call a custom PHP page you put on your server. But I'm still a little confused on how you do that.
You use the php callback function for that.

There are high level instructions in the node settings explaining how to do that.
I saw that. I am...not completely understanding them. I've been through quite a few threads here with discussion on them, but they are a bit over my head currently.

I finally figured out how to make an API call to a particular kit. I figured out how to construct a PHP page which gets the string of data I want. I'm now trying to see how to get that string into a xF page.
So, say for example (or for actually) this was my PHP content. I want what this page returns to go to an xF page. What exactly would the callback argument to this be?


$url = 'https://db.ygoprodeck.com/api/v7/cardinfo.php';
$parameter = $_SERVER['QUERY_STRING'];
$request_url = $url . '?' . $parameter;

$curl = curl_init($request_url);

curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($curl);

echo $response . PHP_EOL;

Top Bottom