So I've been trying to implement PayPal's GetVerifiedStatus API into my website but have been running into the following error:
Fatal error: Uncaught Error: Class 'PayPal\Types\AA\GetVerifiedStatusRequest' not found in C:\xampp\htdocs\paypaltest\getversys.php:14 Stack trace: #0 {main} thrown in C:\xampp\htdocs\paypaltest\getversys.php on line 14
What could the problem be? What I was able to figure out was that that particular directory is missing. But I have no idea as to how to get it because I've looked for it without any success.
I've been using exactly the same code as given by the PayPal SDK. Here it is:
<?php
use PayPal\Service\AdaptiveAccountsService;
use PayPal\Types\AA\AccountIdentifierType;
use PayPal\Types\AA\GetVerifiedStatusRequest;
require_once('bootstrap.php');
$getVerifiedStatus = new GetVerifiedStatusRequest();
$accountIdentifier=new AccountIdentifierType();
$accountIdentifier->emailAddress = $_REQUEST['emailAddress'];
$getVerifiedStatus->accountIdentifier=$accountIdentifier;
$getVerifiedStatus->firstName = $_REQUEST['firstName'];
$getVerifiedStatus->lastName = $_REQUEST['lastName'];
$getVerifiedStatus->matchCriteria = $_REQUEST['matchCriteria'];
$service = new AdaptiveAccountsService(Configuration::getAcctAndConfig());
try {
$response = $service->GetVerifiedStatus($getVerifiedStatus);
} catch(Exception $ex) {
require_once 'Common/Error.php';
exit;
}
$ack = strtoupper($response->responseEnvelope->ack);
if($ack != "SUCCESS"){
echo "<b>Error </b>";
echo "<pre>";
print_r($response);
echo "</pre>";
} else {
echo "<pre>";
print_r($response);
echo "</pre>";
echo "<table>";
echo "<tr><td>Ack :</td><td><div id='Ack'>$ack</div> </td></tr>";
echo "</table>";
}
require_once 'Common/Response.php';
So I'm answering my own question here because I contacted PayPal tech support and was told that the GetVerifiedStatus API is now deprecated and can't be used.
This is the reason for the error.
Related
How may I send a draft with GMAIL API and OAuth2.0 via PHP?
In the official docs there is no reference on how to achieve this with PHP.
Based on the Java example, I tried:
$drafts = array();
try {
$draftsResponse = $service->users_drafts->listUsersDrafts('me');
if ($draftsResponse->getDrafts()) {
$drafts = array_merge($drafts, $draftsResponse->getDrafts());
}
}
catch (Exception $e) {
echo 'An error occurred: ' . $e->getMessage();
}
var_dump($drafts);
foreach ($drafts as $draft) {
echo 'Draft with ID: ' . $draft->getId() . '<br/>';
$abc = $service->users_drafts->send('me',$draft->getId());
var_dump($abc);
}
But of course I am doing something wrong, because it is not working. The first var_dump() returns all drafts. But nothing else happens after that.
Can you please help me?
You have to create a new Google_Service_Gmail_Draft instance and use that, not just supply the id:
foreach ($drafts as $draft) {
$d = new Google_Service_Gmail_Draft();
$d->setId($draft->getId());
$service->users_drafts->send('me', $d);
}
this is my code:
echo "START";
echo "<br />";
try {
$check = json_decode($soundcloud->get('me/followings/2521254'), true);
} catch (Services_Soundcloud_Invalid_Http_Response_Code_Exception $e) {
exit($e->getMessage());
}
echo "<br />";
echo "END";
When I execute the file it looks like this:
START
The requested URL responded with HTTP code 303.
The HTTP code 303 does mean that the user is following a specific person (if not it's 404), but that's not the point - this question is not SoundCloud API related.
The actual problem is: the echo (echo "END";) after the try block isn't executing.
What's the problem, how can I solve this?
I was developing a PhP webservice using NuSOAP library but facing an error. I couldn't understand the error. If anyone knows a solution, please help. Following is my code.
------ server.php ------
<?php
// Pull in the NuSOAP code
require_once('lib/nusoap.php');
// Create the server instance
$server = new soap_server;
// Register the method to expose
$server->register('hello');
// Define the method as a PHP function
function hello($name)
{
return 'Hello, ' . $name;
}
// Use the request to (try to) invoke the service
$HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ?
$HTTP_RAW_POST_DATA : '';
$server->service($HTTP_RAW_POST_DATA);
?>
------ client.php ------
<?php
// Pull in the NuSOAP code
require_once('lib/nusoap.php');
// Create the client instance
$client = new nusoap_client('server.php');
// Check for an error
$err = $client->getError();
if ($err)
{
// Display the error
echo '<h2>Constructor error</h2><pre>' . $err . '</pre>';
// At this point, you know the call that follows will fail
}
// Call the SOAP method
$result = $client->call('hello', array('name' => 'Scott'));
// Check for a fault
if ($client->fault)
{
echo '<h2>Fault</h2><pre>';
print_r($result);
echo '</pre>';
}
else
{
// Check for errors
$err = $client->getError();
if ($err)
{
// Display the error
echo '<h2>Error</h2><pre>' . $err . '</pre>';
}
else
{
// Display the result
echo '<h2>Result</h2><pre>';
print_r($result);
echo '</pre>';
}
}
?>
When I run the client, following error arises.
Error
no transport found, or selected transport is not yet supported!
When you instantiate the nusoap_client:
new nusoap_client('server.php');
Your constructor parameter 'server.php' does not look valid to me. It's supposed to be a valid endpoint:
docs
So, wherever your 'server.php' actually is. Maybe if it's on the same machine running client.php, it might be something like: http://127.0.0.1/app/server.php
I think you should read NuSoap documents more accurate. Some wrongs i found in your code:
An array will be passed to your method and you've used string parameter $name for hello method.
$name['name']; //is correct!
Client should call some instances or web url not HDD url(server.php).
new nusoap_client(SOME_IP_OR_HOSTNAME . '/server.php'); //is correct!
require_once 'server.php';
new nusoap_client($server); //is correct!
new nusoap_client(WSDL_INSTANCE_OBJECT); //is correct!
new nusoap_client('server.php'); //is incorrect!
for more information read NuSoap document.
What is meant by the below error?Why am i getting this.
Fatal error: Uncaught Exception: 601: Parser error: unexpected end of query. thrown in base_facebook.php on line 1039
I'm using a code to delete the invite once the user clicks on it from app tab,but this is not deleting the app request
Here is the code,
foreach ($request_ids as $request_id)
{
echo ("reqeust_id=".$request_id."<br>");
$full_request_id = build_full_request_id($request_id, $user_id);
echo ("full_request_id=".$full_request_id."<br>");
try {
$delete_success = $facebook->api("/$full_request_id",'DELETE');
if ($delete_success) {
echo "Successfully deleted " . $full_request_id;}
else {
echo "Delete failed".$full_request_id;}
}
catch (FacebookApiException $e) {
echo "error";}
}
Why is this bit in quotes?
$facebook->api("/$full_request_id",'DELETE');
Surely it should just be:
$facebook->api($full_request_id,'DELETE');
Other than that I see nothing wrong with your code. Although, it would be good to know what line 1039 in base_facebook.php is.
I am using gigya php sdk, It works well I am able to post to user's wall or profile using socialise.setStatus method but I am have problems when I try to use the publishuseraction method. I get an error Invalid request signature.
$method = "socialize.publishUserAction";
$request = new GSRequest($apiKey,$secretKey,$method);
$userAction = new GSDictionary("{\"title\":\"This is my title\", \"userMessage\":\"This is a user message\", \"description\":\"This is a description\", \"linkBack\":\"http://google.com\", \"mediaItems\":[{\"src\":\"http://www.f2h.co.il/logo.jpg\", \"href\":\"http://www.f2h.co.il\",\"type\":\"image\"}]}");
$request->setParam("userAction", $userAction);
$request->setParam("uid", $userUID);
$response = $request->send();
if($response->getErrorCode()==0){
echo "Success";
} else {
echo ("Error: " . $response->getErrorMessage());
}
UPDATED AFTER USING $response->getLog()
apiMethod=socialize.publishUserAction
apiKey=correct_api_key
params={"userAction":{},uid":"MY_UID","format":"json","httpStatusCodes":"false"}
URL=http://socialize.gigya.com/socialize.publishUserAction postData=uid=urlencoded(MY_UID)&format=json&httpStatusCodes=false&apiKey=correct_api_keyĆtamp=1296229876&nonce=1.29622987636E%2B12&sig=HEdzy%2BzxetV8QvTDjdsdMWh0%2Fz8%3D
server= web504
I used both put method
$userAction = new GSDictionary();
$userAction->put("title", "This is my title");
$userAction->put("userMessage", "This is my user message");
$userAction->put("description", "This is my description");
$userAction->put("linkBack", "http://google.com");
$mediaItems = array();
$mediaItems[0] = new GSDictionary("{\"src\":\"http://www.f2h.co.il/logo.jpg\", \"href\":\"http://www.f2h.co.il\",\"type\":\"image\"}");
& JSON method
$userAction = new GSDictionary("{\"title\":\"This is my title\", \"userMessage\":\"This is a user message\", \"description\":\"This is a description\",
\"linkBack\":\"http://google.com\", \"mediaItems\":[ {\"src\":\"http://www.f2h.co.il/logo.jpg\", \"href\":\"http://www.f2h.co.il\",\"type\":\"image\"}]}");
I get the same error. And User action is empty using both methods. I appreciate any help.
Thanks.
Try calling getLog() for a bit more information about the error:
if($response->getErrorCode()==0){
echo "Success";
} else {
echo ("Error: " . $response->getErrorMessage());
print "<pre>";
print_r($response->getLog());
print "</pre>";
}
Also, are you able to run getUserInfo w/ the SDK? This is a simple test that also requires a signature. Use the example on the PHP SDK page (about 1/2 way down).