On the same site, how do I send data from a plugin file to a theme file?

Question

I hope you enjoy looking at your monitor.

My head blew after two days of hard work and experimenting with various methods. 

I’m having trouble sending variable data (string: link) from a plugin to a theme file to process and return something.

This is how I use curl

$dirrrr="https://mysite.online/wp-content/themes/my-theme/libs/addons/includes/scrapdata.php";

$p_link = 'https://examplesite.com/black-kinemaster-1.html';

$p = $p_link;

$ch = curl_init($dirrrr);

$data = "p=$p" ; //or array('p'=> $p)

curl_setopt($ch, CURLOPT_POST,1);

curl_setopt($ch, CURLOPT_POSTFIELDS, $data);

curl_setopt($ch, CURLOPT_FOLLOWLOCATION  ,1);
curl_setopt($ch, CURLOPT_HEADER      ,0);  // DO NOT RETURN HTTP HEADERS
curl_setopt($ch, CURLOPT_RETURNTRANSFER  ,1);  // RETURN THE CONTENTS OF THE CALL
curl_setopt($ch, CURLOPT_PROTOCOLS, CURLPROTO_HTTPS);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);

curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
$Rec_Data = curl_exec($ch);

What is the best method for sending data between plugins? (Is it wp hooks? if I’m not in wordpress cms and just using pure php?)

thanks

0
Mo.Mah0i 3 weeks 2022-11-07T17:24:12-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse