NetDNA MaxCDN api giving error - php

I am trying to use NetDNA to purge cached URLS from MaxCDN and not able to create the NetDNA object - gives me the following error message:
Fatal error: Class 'NetDNA' not found in purgeCacheDev.php on line 8
Any ideas where to look to resolve this error ?
<?php
ini_set("display_errors",1);
error_reporting(E_ALL);
require_once '../vendor/autoload.php';
$api = new NetDNA("aaa","bbb","ccc");
// get account information
echo $api->get('/account.json');
exit;
?>

Try this:
php composer.phar update -o
within your project folder.
Also make sure your IP(s) are whitelisted: http://support.maxcdn.com/tutorials/how-to-whitelist-your-server-ip-to-use-the-api/

Related

Fatal error: Uncaught Error: Class "zcrmsdk\crm\setup\restclient\ZCRMRestClient" not found

I am trying to connect zoho crm to my website to read data. I cannot get past the title error.
I have installed the sdk in my folder through composer require zohocrm/php-sdk. I am also including the name space at the top of the file use zcrmsdk\crm\setup\restclient\ZCRMRestClient;. So I am not sure what else to try. There is very little documentation on this sdk.
Thanks
This is my php file
<?php
use zcrmsdk\crm\setup\restclient\ZCRMRestClient;
// session_start();
require 'vendor\autoload.php';
$configuration=array("client_id"=>"1000.<client_ID>","client_secret"=>"<client_secret>","redirect_uri"=>"www.google.com","currentUserEmail"=>"marktok206#gmail.com");
ZCRMRestClient::initialize($configuration);
echo "working rn";
?>
This is my .json file
{
"require": {
"zohocrm/php-sdk": "^3.1"
}
}

php require_once autoload.php causing 500 error

hi everyone I'm writing a code where I want to use the autoload.php and I had written it as
<?php
session_start();
require_once "database.php";
require_once '/root/vendor/autoload.php';
use Twilio\Rest\Client;
I'm using this code to run my login_auth.php this code is written in the top of the page, I don't know what is the issue is but if I run this code with terminal by command php login_auth.php this works correct and gives me the output I'm looking for, but if the same thing I run with postman https://demo.conitor.in/PageMyCell/login_auth.php I'm getting error of 500 internal server error, I'm not sure whether issue is with autoload.php or what, but here I'm using twilio so I'm using the autoload.php.

authorization of app using pinterest api php and create board

i am using dirkgroenen library php for authorization of my app and create board
which i downloaded from here
https://github.com/dirkgroenen/Pinterest-API-PHP
evry time i run this code it gives me uncaught error about the line:8
Fatal error: Uncaught Error: Class 'Dotenv\Dotenv' not found in C:\xampp\htdocs\pin\vendor\demo\boot.php:8
here is the code for boot.php
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
require ("../autoload.php");
$dotenv = new Dotenv\Dotenv(__DIR__);
$dotenv->load();
$pinterest = new
DirkGroenen\Pinterest\Pinterest(getenv("4915445646307112766"),
getenv("1ae8683b277958bd9739cedb0f0b1434eee42176dd3d44cbf44981f9acaadd94"));
if (isset($_GET["code"]))
{
$token = $pinterest->auth->getOAuthToken($_GET["code"]);
$pinterest->auth->setOAuthToken($token->access_token);
setcookie("access_token", $token->access_token);
}
else if (isset($_GET["access_token"]))
{
$pinterest->auth->setOAuthToken($_GET["access_token"]);
}
else if (isset($_COOKIE["access_token"]))
{
$pinterest->auth->setOAuthToken($_COOKIE["access_token"]);
}
else
{
assert(false);
}
?>
can anyone please help me to fix it.. i have spent more than 48 hours to resolve this issue..
any help will be greatly appreciated
Obviously, you don't have Dotenv class anywhere where PHP expects it to be found.
Options:
You don't have it at all, then download it from here: vlucas/phpdotenv. Composer should have downloaded it, BUT only if you used composer to install DirkGroenen.
You have it but it is outside autoload path - check autoload path, make sure that Dotenv is located in appropriate vendor-folder.
You have it but it doesn't support autoload (sic!) - check with latest version OR include it directly with include/require
It requires phpunit/phpunit to be installed aswell.

Fzaninotto Faker PHP Fatal Error

I keep getting this error when I am trying to test Faker PHP from github on my server:
Fatal error: Class 'Faker\Provider\en_US\Address' not found in /home/andrew/public_html/JeffWork/src/Faker/Provider/en_US/Address.php on line 6
Link: http://aswanson.net/JeffWork/test/test.php
All of the package files have been installed and uploaded properly, and the code on line 5 & 6 looks like:
class Address extends \Faker\Provider\en_US\Address
{
Please make sure whether the file exists in the folder where your referring for "/home/andrew/public_html/JeffWork/src/Faker/Provider/en_US/Address.php".
Please take a new update with composer with the following
composer require fzaninotto/faker
Now with the updated version 1.6, you will be able to solve this kind of issue make sure to use autoload.php in file where your using.
The following shows the snippet of usage
<?php
require_once 'vendor/autoload.php';
$faker = Faker\Factory::create();
$person = new Faker\Provider\en_US\Person($faker);
$address = new Faker\Provider\en_US\Address($faker);
foreach(range(1,10) as $i){
echo $address->address(),'<br/>';
}
Cheers!

Mailgun SDK unable to find required classes (php)

I'm trying to use the Mailgun API SDK to send emails from my test server. I downloaded the SDK itself as I am not currently using Composer.
However, when I try to instantiate a Mailgun object, I get this error:
Fatal error: Class 'Mailgun\Connection\RestClient' not found in /var/www/mysite.xyz/www/inc/libs/Mailgun/Mailgun.php on line 38
Which I fixed by adding require "Connection/RestClient.php"; to the Mailgun.php file. However, this in turn caused its own error.
Fatal error: Class 'GuzzleHttp\Client' not found in /var/www/mysite.xyz/www/inc/libs/Mailgun/Connection/RestClient.php on line 41
This is included in my includes.php, so for all pages.
#Mailgun php functions
require_once "libs/Mailgun/Mailgun.php";
use Mailgun\Mailgun;
Then, when I try to use this;
# First, instantiate the SDK with your API credentials and define your domain.
$mg = new Mailgun\Mailgun("key-myactualkey");
$domain = "myactualdomain.xyz";
print "Email to send is ".$welcomeemail; #Never gets reached
It causes those fatal errors and the program grinds to a halt.
Why is this happening and how do I fix it?
I had the same problem and fixed it by using composer which is easier then you might think. Just follow these instructions (locally, on your computer, where PHP should be installed):
https://github.com/mailgun/mailgun-php/blob/master/SharedHostInstall.md
Then upload all files generated to your server in a separate directory.
Then include the following lines to your script:
require 'your/path/to/these/files/vendor/autoload.php';
use Mailgun\Mailgun;
Create a new Mailgun object like this:
$mg = new Mailgun("your-secret-key");

Categories