public function fetchConfirmations()
    {
        $url = $this->generateConfirmationUrl();
        $confirmations = [];
        $response = '';
        try {
            $response = $this->mobileAuth->steamCommunity()->cURL($url);
        } catch (\Exception $ex) {
            return $confirmations;
        }
        if (strpos($response, '<div>Nothing to confirm</div>') === false) {
            $confIdRegex = '/data-confid="(\d+)"/';
            $confKeyRegex = '/data-key="(\d+)"/';
            $confOfferRegex = '/data-creator="(\d+)"/';
            $confDescRegex = '/<div>((Confirm|Trade with|Sell -) .+)<\/div>/';

            preg_match_all($confIdRegex, $response, $confIdMatches);
            preg_match_all($confKeyRegex, $response, $confKeyMatches);
            preg_match_all($confOfferRegex, $response, $confOfferMatches);
            preg_match_all($confDescRegex, $response, $confDescMatches);

            if (count($confIdMatches[1]) > 0 && count($confKeyMatches[1]) > 0 && count($confDescMatches) > 0 && count($confOfferMatches) > 0) {
                $checkedConfIds = [];

                for ($i = 0; $i < count($confIdMatches[1]); $i++) {
                    $confId = $confIdMatches[1][$i];

                    if (in_array($confId, $checkedConfIds)) {
                        continue;
                    }

                    $confKey = $confKeyMatches[1][$i];
                    $confOfferId = $confOfferMatches[1][$i];
                    $confDesc = $confDescMatches[1][$i];
                    $confirmations[] = new Confirmation($confId, $confKey, $confOfferId, $confDesc);

                    $checkedConfIds[] = $confId;
                }
            } else {
                throw new WgTokenInvalidException();
            }
        }
        return $confirmations;
    }
public function fetchConfirmations()
    {
        $url = $this->generateConfirmationUrl();
        $confirmations = [];
        $response = '';
        try {
            $response = $this->mobileAuth->steamCommunity()->cURL($url);
        } catch (\Exception $ex) {
            return $confirmations;
        }
        if (strpos($response, '<div>Nothing to confirm</div>') === false) {
            $confIdRegex = '/data-confid="(\d+)"/';
            $confKeyRegex = '/data-key="(\d+)"/';
            $confOfferRegex = '/data-creator="(\d+)"/';
            $confDescRegex = '/<div>((Confirm|Trade with|Sell -) .+)<\/div>/';

            preg_match_all($confIdRegex, $response, $confIdMatches);
            preg_match_all($confKeyRegex, $response, $confKeyMatches);
            preg_match_all($confOfferRegex, $response, $confOfferMatches);
            preg_match_all($confDescRegex, $response, $confDescMatches);

            if (count($confIdMatches[1]) > 0 && count($confKeyMatches[1]) > 0 && count($confDescMatches) > 0 && count($confOfferMatches) > 0) {
                $checkedConfIds = [];

                for ($i = 0; $i < count($confIdMatches[1]); $i++) {
                    $confId = $confIdMatches[1][$i];

                    if (in_array($confId, $checkedConfIds)) {
                        continue;
                    }

                    $confKey = $confKeyMatches[1][$i];
                    $confOfferId = $confOfferMatches[1][$i];
                    $confDesc = $confDescMatches[1][$i];
                    $confirmations[] = new Confirmation($confId, $confKey, $confOfferId, $confDesc);

                    $checkedConfIds[] = $confId;
                }
            } else {
                throw new WgTokenInvalidException();
            }
        }
        return $confirmations;
    }
public function fetchConfirmations ( ) { $ url = $ this -> generateConfirmationUrl ( ) ; $ confirmations = [ ] ; $ response = '' ; try { $ response = $ this -> mobileAuth -> steamCommunity ( ) -> cURL ( $ url ) ; } catch ( \ Exception $ ex ) { return $ confirmations ; } if ( strpos ( $ response , '<div>Nothing to confirm</div>' ) === false ) { $ confIdRegex = '/data-confid="(\d+)"/' ; $ confKeyRegex = '/data-key="(\d+)"/' ; $ confOfferRegex = '/data-creator="(\d+)"/' ; $ confDescRegex = '/<div>((Confirm|Trade with|Sell -) .+)<\/div>/' ; preg_match_all ( $ confIdRegex , $ response , $ confIdMatches ) ; preg_match_all ( $ confKeyRegex , $ response , $ confKeyMatches ) ; preg_match_all ( $ confOfferRegex , $ response , $ confOfferMatches ) ; preg_match_all ( $ confDescRegex , $ response , $ confDescMatches ) ; if ( count ( $ confIdMatches [ 1 ] ) > 0 && count ( $ confKeyMatches [ 1 ] ) > 0 && count ( $ confDescMatches ) > 0 && count ( $ confOfferMatches ) > 0 ) { $ checkedConfIds = [ ] ; for ( $ i = 0 ; $ i < count ( $ confIdMatches [ 1 ] ) ; $ i ++ ) { $ confId = $ confIdMatches [ 1 ] [ $ i ] ; if ( in_array ( $ confId , $ checkedConfIds ) ) { continue ; } $ confKey = $ confKeyMatches [ 1 ] [ $ i ] ; $ confOfferId = $ confOfferMatches [ 1 ] [ $ i ] ; $ confDesc = $ confDescMatches [ 1 ] [ $ i ] ; $ confirmations [ ] = new Confirmation ( $ confId , $ confKey , $ confOfferId , $ confDesc ) ; $ checkedConfIds [ ] = $ confId ; } } else { throw new WgTokenInvalidException ( ) ; } } return $ confirmations ; }
Fetch list of confirmations. May need to retry more than once because of Steam occasionally not showing any confirmations.
@return Confirmation[]
@throws WgTokenInvalidException Thrown when session is invalid.
Fetch list of confirmations . May need to retry more than once because of Steam occasionally not showing any confirmations .