Reputation: 61
My PHP application was working on my localhost and now I upload to server to receive the error Class 'PayPal\REST\ApiContext' not found. I had a similar problem where the the require '/../vendor/autoload.php'; wasn't being accessed. I have made sure that that line is accessable. I didn't see a clear answer and thought to post seeing if any ideas. I compressed the SDK and unpacked in the file manager on the server. Any help would be appreciated. I have looked at the documentation and followed outlines to a T. When the error is displayed the address bar says http://www.mattmacy.com/greenia/Composer_Paypal_SDK/member/payment.php?link=8&ANON=8 . This leads me to believe there is some conflict in the payment file. It said on a post to remove the first '/' from /../vendor/autoload.php but this only raised another error.
use PayPal\REST\ApiContext;
use PayPal\Auth\OAuthTokenCredential;
session_start();
include('connect.php');
if (!empty($_GET['ANON'])){
$ANONYMOUS = $_GET['ANON'];
}
if (isset($_SESSION['uid'])){
$userPAYPAL = $_SESSION['uid'];
//ANONYMOUS is memembers_id
} elseif (!empty($_GET['ANON'])){
//$memberPAYPAL = $ANONYMOUS;
$userPAYPAL = $ANONYMOUS;
//echo "ANONYMOUS set";
}elseif (!empty($_GET['link'])){
$MP3_id = $_GET['link'];
header("Location: ../src/wouldYouLiketoRegister.php?link=".$MP3_id);
}
require __DIR__ . '/../vendor/autoload.php';
//create new PayPal API context
$api = new ApiContext(
new OAuthTokenCredential(
'AZp2HH9aWL2QxjVZRO51N33ZLqweiO5x_GPIyUMWgqLYhe0yxfQSPhJaUkCyqx',
'EGpHg8K23idpNF895v6Zm4rybajrvAoED6T0As0NUk4q2fhJ7oDv82z1PK'
)
);
Upvotes: 0
Views: 941