Skip to content

Instantly share code, notes, and snippets.

View dreboard's full-sized avatar

Andre Board dreboard

View GitHub Profile
<?php
/**
* Return the value of an array closests to zero
* @param array $ts
* @return int
* @see https://ourcodeworld.com/articles/read/1042/how-to-find-the-closest-value-to-zero-from-an-array-with-positive-and-negative-numbers-in-php
**/
function closeToZero(array $ts) :int
{
if(empty($ts)){
@dreboard
dreboard / ItemAndCategory.php
Created December 30, 2019 05:10
Get Item and its category
<?php
/*
GetSingleItem
https://developer.ebay.com/DevZone/shopping/docs/CallRef/GetSingleItem.html
GetSingleItemRequestType
https://developer.ebay.com/Devzone/shopping/docs/CallRef/types/GetSingleItemRequestType.html
SDK
https://github.com/davidtsadler/ebay-sdk-examples/blob/master/shopping/02-get-single-item.php
@dreboard
dreboard / GetCategoryInfo.php
Created December 30, 2019 04:26
Get Category Information
/*
GetCategoryInfo
https://developer.ebay.com/devzone/shopping/docs/callref/GetCategoryInfo.html#Samples
SDK
https://github.com/davidtsadler/ebay-sdk-examples/blob/master/shopping/03-get-category-info.php
*/
require_once '_inc.php';
@dreboard
dreboard / GetSingleItemSDK.php
Last active November 27, 2019 04:01
Get single item using SDK
<?php
/**
* @since v0.1.0
* @package Dev-PHP
* @author Andre Board <dre.board@gmail.com>
* @version v1.0
* @access public
* @see https://github.com/davidtsadler/ebay-sdk-examples/blob/master/shopping/02-get-single-item.php
*/
@dreboard
dreboard / GetOrdersRequestType.php
Created November 25, 2019 05:35
Get Orders Request
/**
* Get My Selling getSellerOrders (GetOrdersRequestType)
* @return \Illuminate\Http\JsonResponse|mixed
* @see https://developer.ebay.com/devzone/xml/docs/reference/ebay/getmyebayselling.html
* @see https://developer.ebay.com/DevZone/XML/docs/Reference/ebay/GetOrders.html#Request.CreateTimeFrom
* @see https://stackoverflow.com/questions/30254723/how-to-fetch-my-listings-of-product-from-ebay
* {@internal TESTED}}
*/
public function getSellerOrders(int $days = null)
{
@dreboard
dreboard / GetSingleItem.php
Last active November 26, 2019 23:13
eBay getItem
<?php
/*
GetSingleItem
Using either the SDK or raw eBay API call, get an item by itemID. You can use the XML or URl versions
@see https://developer.ebay.com/DevZone/shopping/docs/CallRef/GetSingleItem.html#samplebasic
-------------------------------------------------------------------------------------------------------
-- URL version
https://open.api.ebay.com/shopping?
callname=GetSingleItem&
@dreboard
dreboard / ebayGetOrders.php
Created November 25, 2019 05:26
Ebay GetOrders
<?php
//header('Content-Type: text/xml');
/*
getOrders
https://developer.ebay.com/api-docs/sell/fulfillment/resources/order/methods/getOrders
Use this call to search for and retrieve one or more orders based on their creation date,
last modification date, or fulfillment status using the filter parameter.
You can alternatively specify a list of orders using the orderIds parameter.
error_reporting(E_ALL);
try{
$version = '1.0.0'; // API version supported by your application
$globalid = 'EBAY-US'; // Global ID of the eBay site you want to search (e.g., EBAY-DE)
//$query = $_POST['search'];
$query = 'Samsung galaxy note 9'; // You may want to supply your own query
$safequery = urlencode($query); // Make the query URL-friendly
$affiliate_trackingId = 'TRACKING';
$affiliate_customId = 'test';
@dreboard
dreboard / .htaccess
Last active August 24, 2019 06:31
Remove Public from URL Laravel 5.8
# Place in root dir NOT public dir
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^ ^$1 [N]
@dreboard
dreboard / ide.php
Created August 22, 2019 04:21
Basic Online PHP Compiler
<?php
error_reporting(E_ALL);
ini_set('html_errors', 0);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>PHP IDE</title>