1. Go to this page and download the library: Download hkonnet/laravel-ebay library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
use \Hkonnet\LaravelEbay\EbayServices;
use \DTS\eBaySDK\Shopping\Types;
// Create the service object.
$ebay_service = new EbayServices();
$service = $ebay_service->createShopping();
// Create the request object.
$request = new Types\GeteBayTimeRequestType();
// Send the request to the service operation.
$response = $service->geteBayTime($request);
// Output the result of calling the service operation.
printf("The official eBay time is: %s\n", $response->Timestamp->format('H:i (\G\M\T) \o\n l jS Y'));
use \DTS\eBaySDK\Shopping\Services;
use \DTS\eBaySDK\Shopping\Types;
$config = Ebay::getConfig();
// Create the service object.
$service = new Services\ShoppingService($config);
// Create the request object.
$request = new Types\GeteBayTimeRequestType();
// Send the request to the service operation.
$response = $service->geteBayTime($request);
// Output the result of calling the service operation.
printf("The official eBay time is: %s\n", $response->Timestamp->format('H:i (\G\M\T) \o\n l jS Y'));
use \Hkonnet\LaravelEbay\EbayServices;
use \DTS\eBaySDK\Finding\Types;
// Create the service object.
$ebay_service = new EbayServices();
$service = $ebay_service->createFinding();
// Assign the keywords.
$request = new Types\FindItemsByKeywordsRequest();
$request->keywords = 'Harry Potter';
// Ask for the first 25 items.
$request->paginationInput = new Types\PaginationInput();
$request->paginationInput->entriesPerPage = 25;
$request->paginationInput->pageNumber = 1;
// Ask for the results to be sorted from high to low price.
$request->sortOrder = 'CurrentPriceHighest';
$response = $service->findItemsByKeywords($request);
// Output the response from the API.
if ($response->ack !== 'Success') {
foreach ($response->errorMessage->error as $error) {
printf("Error: %s <br>", $error->message);
}
} else {
foreach ($response->searchResult->item as $item) {
printf("(%s) %s:%.2f <br>", $item->itemId, $item->title, $item->sellingStatus->currentPrice->value);
}
}
use DTS\eBaySDK\Finding\Services\FindingService;
use \DTS\eBaySDK\Finding\Types;
// Create the service object.
$config = Ebay::getConfig();
$service = new FindingService($config);
// Assign the keywords.
$request = new Types\FindItemsByKeywordsRequest();
$request->keywords = 'Harry Potter';
// Ask for the first 25 items.
$request->paginationInput = new Types\PaginationInput();
$request->paginationInput->entriesPerPage = 25;
$request->paginationInput->pageNumber = 1;
// Ask for the results to be sorted from high to low price.
$request->sortOrder = 'CurrentPriceHighest';
$response = $service->findItemsByKeywords($request);
// Output the response from the API.
if ($response->ack !== 'Success') {
foreach ($response->errorMessage->error as $error) {
printf("Error: %s <br>", $error->message);
}
} else {
foreach ($response->searchResult->item as $item) {
printf("(%s) %s:%.2f <br>", $item->itemId, $item->title, $item->sellingStatus->currentPrice->value);
}
}
use \DTS\eBaySDK\Constants;
use \DTS\eBaySDK\Trading\Types;
use \DTS\eBaySDK\Trading\Enums;
use \Hkonnet\LaravelEbay\EbayServices;
/**
* Create the service object.
*/
$ebay_service = new EbayServices();
$service = $ebay_service->createTrading();
/**
* Create the request object.
*/
$request = new Types\GetMyeBaySellingRequestType();
/**
* An user token is new Types\ItemListCustomizationType();
$request->ActiveList->Include = true;
$request->ActiveList->Pagination = new Types\PaginationType();
$request->ActiveList->Pagination->EntriesPerPage = 10;
$request->ActiveList->Sort = Enums\ItemSortTypeCodeType::C_CURRENT_PRICE_DESCENDING;
$pageNum = 1;
do {
$request->ActiveList->Pagination->PageNumber = $pageNum;
/**
* Send the request.
*/
$response = $service->getMyeBaySelling($request);
/**
* Output the result of calling the service operation.
*/
echo "==================\nResults for page $pageNum\n==================\n";
if (isset($response->Errors)) {
foreach ($response->Errors as $error) {
printf(
"%s: %s\n%s\n\n",
$error->SeverityCode === Enums\SeverityCodeType::C_ERROR ? 'Error' : 'Warning',
$error->ShortMessage,
$error->LongMessage
);
}
}
if ($response->Ack !== 'Failure' && isset($response->ActiveList)) {
foreach ($response->ActiveList->ItemArray->Item as $item) {
printf(
"(%s) %s: %s %.2f\n",
$item->ItemID,
$item->Title,
$item->SellingStatus->CurrentPrice->currencyID,
$item->SellingStatus->CurrentPrice->value
);
}
}
$pageNum += 1;
} while (isset($response->ActiveList) && $pageNum <= $response->ActiveList->PaginationResult->TotalNumberOfPages);
use \Hkonnet\LaravelEbay\EbayServices;
// Create the service object.
$ebay_service = new EbayServices();
$service = $ebay_service->createFinding();