承接 notfoundsam/yahoo-auction 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

notfoundsam/yahoo-auction

Composer 安装命令:

composer require notfoundsam/yahoo-auction

包简介

Yahoo auction bidder

README 文档

README

Description

This library will help you to work with Yahoo auction. It makes requests to Yahoo auction like a normal browser. To use this library you must specify your username and password from Yahoo to login. In order not to make a login every time, after the first login, save your cookies so that the following requests will be in the same session. You can view your won lots and bidding lots. To get information about the lot or bid on the lot, you will need an application key.

Requirements

  • php >= 5.4
  • php-curl
  • php-mbstring
  • php-xml

Installation

composer require notfoundsam/yahoo-auction

Examples

Specify your credentials and create a new instance of Browser object.

require __DIR__ . '/../vendor/autoload.php';

use Yahooauc\Browser as Browser;

$userName = "your_yahoo_user";
$userPass = "your_yahoo_pass";

/* Get saved cookie */
$cookie = file_get_contents('cookie.cache');
$cookieJar = $cookie !== false ? unserialize($cookie) : [];

$browser = new Browser($userName, $userPass, null, $cookieJar);

If you don't have cookies yet try to login into Yahoo. It throws LoginException or CaptchaException if something wrong.

/* Try to login into Yahoo */
var_dump($browser->login());

If you already have cookies try to check it.

/* Check is logged in */
var_dump($browser->checkLogin());

Use the next methods to get information about your auctions or bid on the lot.

/* Get information about the lot */
var_dump($browser->getAuctionInfoAsXml("auction_lot_id"));

/* Get list of lots from the first bidding page */
var_dump($browser->getBiddingLots(1));

/* Get array of auction id from the first won page */
var_dump($browser->getWonIds(1));

/* Bid on the lot. The second argument is price in yen */
var_dump($browser->bid("auction_lot_id", 100));

In the end save your browser cookies to use it next time.

$cookieJar = $browser->getCookie();
$cookie = serialize($cookieJar);
file_put_contents('cookie.cache', $cookie);

Debug

Since v1.1.0 you can use the debugging mode to test your application locally. Export YAHOO_AUC_ENV to your environment. Set it to production to use on production or other to use the debugging mode.

export YAHOO_AUC_ENV=local

You can also enable or disable the debugging mode with the following method.
Pass the second argument with the path to the folder with your test files.

$browser->debug($debug = true);
$browser->debug($debug = true, $testPath = 'your_folder_with_test_pages');

How to use the debugging mode

Replace test_user with something else to throw LoginException. It means the login failed.

$userName = "not_test_user";
$userPass = "secret_password";

$browser = new Browser($userName, $userPass, null, []);
$browser->debug($debug = true);

Pass the following id n000000000 to throw PageNotfoundException. It means the auction not found.

$userName = "test_user";
$userPass = "secret_password";

$browser = new Browser($userName, $userPass, null, []);
$browser->debug($debug = true);
$browser->getAuctionInfoAsXml("n000000000");

Get an array of fake data from the first bidding page.

$userName = "test_user";
$userPass = "secret_password";

$browser = new Browser($userName, $userPass, null, []);
$browser->debug($debug = true);
$browser->getBiddingLots(1);

Get an array of fake IDs from the first won page.

$userName = "test_user";
$userPass = "secret_password";

$browser = new Browser($userName, $userPass, null, []);
$browser->debug($debug = true);
$browser->getWonIds(1);

Bid on the following lot e000000000 to throw AuctionEndedException. This auction has already ended.
Bid on the following lot x000000000 with price under 220 to throw BrowserException. It means your price is lower than the current price.
Bid on the following lot x000000000 with price between 220 and 999 to throw RebidException. It means the price of the lot has rose, and the bid failed.
Bid on the following lot x000000000 with price more than 999 for a successful bid.

$userName = "test_user";
$userPass = "secret_password";

$browser = new Browser($userName, $userPass, null, []);
$browser->debug($debug = true);
$browser->bid("e000000000", 1000); // Has already ended
$browser->bid("x000000000", 100);  // Not enough
$browser->bid("x000000000", 500);  // Rebid page, bid failed
$browser->bid("x000000000", 1000); // Success

About v1.3.x

Features

  • Added xdebug to the docker container.

Updates

  • Yahoo auction API was removed because Yahoo fully closed their API.
  • If the page or lot not found it will throw PageNotfoundException.
  • Check login with new request (Sometimes after login Yahoo shows different page).
  • Remove unnecessary request options in Browser constructor.

Fixes

  • The method getAuctionImgsUrl returned empty array.

Notes

  • Field $appId don't need anymore, pass null instead to the Browser constructor.
  • Method $browser->getAuctionInfoAsXml("...") returns shorted version of API result. Currently, available fields: AuctionID, AuctionItemUrl, Title, Seller->Id, Img, Price, TaxinPrice, StartTime, EndTime, Status.

Migration from v1.2.x

  • Check available fields for $browser->getAuctionInfoAsXml("...") in Notes.

统计信息

  • 总下载量: 202
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 16
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 16
  • Watchers: 5
  • Forks: 7
  • 开发语言: HTML

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-03-01

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固