I found this here: https://stackoverflow.com/questions/45409522/file-get-contents-not-working-with-bearer
But where do i get the Bearer Token?
And do you know if this way does work?
Ah ok i found a code for the api, here for everyone who may also want to proceed similiar stuff like me 🙂
With the PHP library cURL (this is installed as standard in many PHP installs)!
in the above code there are three variables you have to change yourself:
DOMAIN = Your Domain the WordPress website is running
NUMBER = Folder number by filebird
TOKEN = You can create one in the Admin (Settings/FileBird/API)
$url = "DOMAIN/wp-json/filebird/public/v1/attachment-id/?folder_id=NUMBER";
$token = "TOKEN";
//setup the request, you can also use CURLOPT_URL
$ch = curl_init($url);
// Returns the data/output as a string instead of raw data
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
//Set your auth headers
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Authorization: Bearer ' . $token
));
// get stringified data/output. See CURLOPT_RETURNTRANSFER
$data = curl_exec($ch);
// get info about the request
$info = curl_getinfo($ch);
// close curl resource to free up system resources
curl_close($ch);
echo $data;
But you could answer on my first question anywhere 🙂
Are there a view Hooks in PHP?
-
This reply was modified 5 years, 2 months ago by
neueweide.
Plugin Support
Bruce
(@ninjateamwp)
Hi @neueweide ,
I am glad to know you figured some of these queries out now, may I know which specific question is there that you need an answer to right now, please?
Kind regards,
-Bruce-
Plugin Support
Bruce
(@ninjateamwp)
Hi @neueweide ,
Can you explain your request better, please. What do you mean by this hook?
https://drive.google.com/file/d/1IeTucUWcjYsoIV86hWEtKv9pNezHMQ0g/view?usp=drivesdk
Thank you!
Kind regards,
-Bruce-
I mean,
my solution queries your JSON-Api (=URL-Request) with PHP techniques.
But in general WordPress has a System for embedding shared functionality by Plugin Developer through so called “Hooks”. You can get information about this concept here:
https://developer.ww.wp.xz.cn/plugins/hooks/
In your case it would be the “Custom Hooks” wich could give programatically access for other developer like me to your Plugin:
https://developer.ww.wp.xz.cn/plugins/hooks/custom-hooks/
best regards
robert
Plugin Support
Bruce
(@ninjateamwp)
Hi @neueweide ,
Maybe what you are describing is possible! But we do not understand your processing flow properly.
Can you give us access to the UI you have made?
Also, since this is not a bug support but a custom work discussion, you could continue this case with our team at:
[email protected]
Thank you!
Kind regards,
-Bruce-
Hi Bruce,
i said i plan to do and there is no code yet i could show you… i’m still in concept thoughts haha 🙂
you can close this topic 🙂
best robert