Cloudinary AI background removal fatal error - php

I am trying to use Cloudinary AI background removal tool. This is the code I am using (Code snippet provided by Cloudinary)
if(isset($_POST["submit"])){
\Cloudinary\Uploader::upload("https://www.popwebdesign.net/popart_blog/wp-content/uploads/2019/05/slike-prirode-za-desktop-757.jpg",
array(
"public_id" => "dog_couch",
"background_removal" => "cloudinary_ai"
));
}
I get this error
Fatal error: Uncaught Error: Class 'Cloudinary\Error' not found in /storage/ssd5/884/7393884/public_html/Uploader.php:534 Stack trace: #0 /storage/ssd5/884/7393884/public_html/Uploader.php(408): Cloudinary\Uploader::call_api('upload', Array, Array, 'https://www.pop...') #1 /storage/ssd5/884/7393884/public_html/Uploader.php(101): Cloudinary\Uploader::call_cacheable_api('upload', Array, Array, 'https://www.pop...') #2 /storage/ssd5/884/7393884/public_html/index.php(13): Cloudinary\Uploader::upload('https://www.pop...', Array) #3 {main} thrown in /storage/ssd5/884/7393884/public_html/Uploader.php on line 534
When I use part just for uploading it works perfectly
if(isset($_POST["submit"])){
\Cloudinary\Uploader::upload("https://www.popwebdesign.net/popart_blog/wp-content/uploads/2019/05/slike-prirode-za-desktop-757.jpg");
}
as soon as I add array part I get the error. I can't see what I am doing wrong since this code is directly from cloudinary. I've found it here: https://cloudinary.com/documentation/cloudinary_ai_background_removal_addon
I have tried to search the internet, but could not find a solution for this.
Any help is appreciated!

Related

I'm try using Spotify PHP api

I'm try to use api from
https://github.com/jwilsson/spotify-web-api-php/blob/main/docs/examples/access-token-with-authorization-code-flow.md.
Unfortunately, it doesn't work well because it gets such an error
Fatal error: Uncaught SpotifyWebAPI\SpotifyWebAPIAuthException: Invalid redirect URI in D:\Software\Development\XAMPP\htdocs\spotif\auth\vendor\jwilsson\spotify-web-api-php\src\Request.php:56 Stack trace: #0 D:\Software\Development\XAMPP\htdocs\spotif\auth\vendor\jwilsson\spotify-web-api-php\src\Request.php(244): SpotifyWebAPI\Request->handleResponseError('{"error":"inval...', 400) #1 D:\Software\Development\XAMPP\htdocs\spotif\auth\vendor\jwilsson\spotify-web-api-php\src\Request.php(112): SpotifyWebAPI\Request->send('POST', 'https://account...', 'client_id=48f0c...', 'HTTP/2 400 \r\nda...') #2 D:\Software\Development\XAMPP\htdocs\spotif\auth\vendor\jwilsson\spotify-web-api-php\src\Session.php(250): SpotifyWebAPI\Request->account('POST', '/api/token', Array, Array) #3 D:\Software\Development\XAMPP\htdocs\spotif\auth\app\check.php(26): SpotifyWebAPI\Session->requestAccessToken('AQA9X84L0SDucXG...', 'a86937efa85589a...') #4 {main} thrown in D:\Software\Development\XAMPP\htdocs\spotif\auth\vendor\jwilsson\spotify-web-api-php\src\Request.php on line 56
I tried to solve the problem with all methods,but even if in the console of my Spotify application.
I have everything set up well, like the redirect URI in my PHP code, I still get an error.
Changing the redirectURI doesn't help me in any way.
Wait some hours/days fixing my problem

PHP Fatal error: Uncaught Error: Call to undefined function

I have recently migrated from the old PHP5xx to PHP7.4.23 version and below is the error message when localhost URL is tested. I can confirm the index.php has reference to include rightbar.php from the same folder destination. If I remove the reference to rightbar.php then the website loads perfectly. I am not a coder but would need some great help on this.
Website error:`PHP Fatal error:
Uncaught Error: Call to undefined function getResultBYkeyword() in
C:\inetpub\wwwroot\tamilmelisai\rightbar.php:169 Stack trace:
#0 C:\inetpub\wwwroot\tamilmelisai\index.php(28): include()
#1 {main} thrown in C:\inetpub\wwwroot\tamilmelisai\rightbar.php on line 169`
Line 169 of rightbar.php has the following code:
<?php $videoDetailstops = getResultBYkeyword("latest tamil trailers",3); if(count($videoDetailstops)):?>
After lots and trial and error, fianlly below is the solution that I worked it out even though I am not a coder by any chance. Appreciate all those who looked at the query and responded.
Form this:
<?php $videoDetailstops = getResultBYkeyword("latest tamil trailers",3); if(count($videoDetailstops)):?>
To this:
<?php if (isset ($videoDetailstops) && $videoDetailstops = getResultBYkeyword("latest tamil trailers",3));?>

WordPress - Fatal error: Uncaught Error: Undefined constant "SBVCGMAP_PLUGIN_VERSION"

I just moved my wordpress site from a server to my localhost to make some changes.
The websites on the server works great. But when i run it on localhost i get this.
Fatal error: Uncaught Error: Undefined constant "SBVCGMAP_PLUGIN_VERSION" in
/opt/lampp/htdocs/cruiceWP/wp-content/plugins/modeltheme-framework/inc/sb-google-
maps-vc-addon/sb-google-maps-vc-addon.php:3 Stack trace: #0
/opt/lampp/htdocs/cruiceWP/wp-content/plugins/modeltheme-framework/modeltheme-
framework.php(65): require_once() #1 /opt/lampp/htdocs/cruiceWP/wp-settings.php(409):
include_once('/opt/lampp/htdo...') #2 /opt/lampp/htdocs/cruiceWP/wp-config.php(90):
require_once('/opt/lampp/htdo...') #3 /opt/lampp/htdocs/cruiceWP/wp-load.php(50):
require_once('/opt/lampp/htdo...') #4 /opt/lampp/htdocs/cruiceWP/wp-blog-
header.php(13): require_once('/opt/lampp/htdo...') #5
/opt/lampp/htdocs/cruiceWP/index.php(17): require('/opt/lampp/htdo...') #6 {main}
thrown in /opt/lampp/htdocs/cruiceWP/wp-content/plugins/modeltheme-framework/inc/sb-
google-maps-vc-addon/sb-google-maps-vc-addon.php on line 3
Notice: is_embed was called incorrectly. The conditional functions do not work before the
query is executed. Before the basic application they give false. Please see the Debugging
in WordPress page for more information. (This message was added in version 3.1.0.) In
/opt/lampp/htdocs/cruiceWP/wp-includes/functions.php on line 5535
Notice: is_search was called incorrectly. The conditional functions do not work before
the query is executed. Before the basic application they give false. Please see the
Debugging in WordPress page for more information. (This message was added in version
3.1.0.) In /opt/lampp/htdocs/cruiceWP/wp-includes/functions.php on line 5535
This is the file that has the problem as the error message says.
sb-google-maps-vc-addon.php
<?php
#define(SBVCGMAP_PLUGIN_VERSION,'1.4'); //Plugin Version
#define(SBVCGMAP_PLUGIN_NAME, 'MT Google Maps'); //Plugin Name
#define(SBVCGMAP_PLUGIN_DIR, trim(plugin_dir_url(__FILE__), '/')); //Plugin Dir
#define(SBVCGMAP_PLUGIN_PATH, trim(plugin_dir_path(__FILE__), '/')); //Plugin Path
//Including all common functions
include('inc/functions.php');
//Including admin panel
include('admin/admin-panel.php');
//Including shortcodes
include('shortcodes.php');
Im stuck for days in this. Does anyone have any idea?
PHP constant names need to be defined as strings. Prior to PHP 8, if you passed an unquoted string, PHP would raise a warning but still treat it as a string which is why that developer included the silencing # operator.
The fix is to quote the names, and I’d remove the #, too
define('SBVCGMAP_PLUGIN_VERSION','1.4');

Keep on getting error on website using AnchorCMS

I’m attempting to use AnchorCMS. I keep on getting this message at the bottom of my page.
Uncaught Exception
Undefined offset: 6
Origin
on line 90
Trace
#0 [internal function]: System\Error::shutdown()
#1 {main}
I’ve already tried deleting and reloading all files.
I also have the same problem as you. I tried to edit in Anchor/config/error.php report => true to report => false, but I’ve got a server error. Then I deleted the value (true or false), left it blank, and it succeed.

SoapClient in PHP throwing SoapFault exception: [HTTP] Forbidde

I am completely inexperience with this whole SOAP concept so I have no idea what to look for when I see an error.
So basically I am trying to pull some data from another company. That company gave me a digital certificate and and some xsd & wsdl files and asked me for my server's IP so they could whitelist it. As I mentioned, I have no idea what to do with the files they gave me, so I uploaded them to my server and then I started googling, and I have pasted together the following code (although I don't even know if it makes sense):
$protected_url = "http://www.myurl.com/WSDLFILE.wsdl";
$my_cert_file = "http://www.myurl.com/CERTFILE.pem";
$client = new SoapClient($protected_url, array('local_cert'=> $my_cert_file,'trace'=>1));
$params->Affiliate->AffiliateID = 555;
$params->Address->AddressLine = "123 Main Street";
$params->Contact = 'No';
$result = $client->QueryAddress($params);
And I get the following error
[10-Apr-2013 18:59:46 America/New_York] PHP Fatal error: Uncaught SoapFault exception: [HTTP] Forbidden in /home/mysite/index.php:15
Stack trace:
#0 [internal function]: SoapClient->__doRequest('<?xml version="...', 'https://secure....', 'http://www....', 1, 0)
#1 /home/mysite/index.php(15): SoapClient->__call('QueryAddress', Array)
#2 /home/mysite/index.php(15): SoapClient->QueryAddress(Object(stdClass))
#3 {main}
thrown in /home/mysite/index.php on line 15
It's kind of hard to search for help because I dont even know what I'm searching for, so any guidance is appreciated
EDIT: I should also add that I have actually been able to get a successful response by using cURL and setting the "CURLOPT_SSLCERT" option, but I need to use SOAP
(Answered in the comments. Converted to a community wiki answer. See Question with no answers, but issue solved in the comments (or extended in chat) )
The OP wrote:
SOLVED: My problem was the way I was using the .wsdl file. I thought I had to upload the one they provided and then use it when creating the SoapClient, but that was not the case. What I needed to was reference their wsdl url, which ended in something like https:......asmx?WSDL

Categories