Giter Site home page Giter Site logo

reso-webapi-client-php's Issues

Memory leak

I am seeing a significant memory leak, and it's not clear to me what I can do about it.

Steps to Reproduce

When I request Properties (either through /Properties or /replication), each fetch results in a proportional memory usage. For replication where the limit is grabbing 2,000 listings, I see a usage of about 35 Mb.

Looping using the next url uses an equivalent amount of memory for each loop. For instance, when replicating, each batch of 2,000 listings adds to overall memory consumption by about 35 Mb. My script has a memory_limit of 512 Mb, and

Expected behavior:

I do not see any API method to free up the previous data. I am unsetting the returned json manually, but that is not helping.

Actual behavior:
Debug:
`
[replicate] [1] Replication found 2,000 listings [using 205,445,336 bytes]

[replicate] [2] Replication found 2,000 listings [using 240,005,560 bytes]

[replicate] [3] Replication found 2,000 listings [using 275,442,864 bytes]

[replicate] [4] Replication found 2,000 listings [using 310,723,216 bytes]
`

Reproduces how often:
This is consistent behavior.

Versions

Using the latest Aug 13, 2018 version of RESO-WebAPI-Client-PHP
php 7.2

Additional Information

`do {
RESO\RESO::setAccessToken("my auth token");
RESO\RESO::setAPIRequestUrl("https://api.bridgedataoutput.com/api/v2/OData/miamire/");
$this->replicate_url = "/replication";

RESO\Request::setAcceptType("json");

$json_obj							= RESO\Request::request($this->replicate_url, 'json', $decode_json = true);

$this->replicate_url				= null;
if (is_array($json_obj))
	{
	if (isset($json_obj['@odata.nextLink']) && !empty($json_obj['@odata.nextLink']))	{
		$this->replicate_url		= $roverWEBAPIAUTH->reso_property_replication_url(
																				$one_class, 
																				$json_obj['@odata.nextLink']
																				);
		}
	}

unset($json_obj);
} while (!is_null($this->replicate_url));`

Difficulty Implementing Basic Use-Case

Difficulty Implementing Basic Use-Case

Description

I'm coming from the Spark Platform site, where I recently subscribed to a Data Plan. This Plan provides me with an MLS account username that I will be retrieving data for (for an office/agent), and an API Access Token.

The examples I'm seeing in this repo are quite confusing to me as they use different terms than the Spark Platform documentation, and there are many more options than my use-case requires, I think. So, I'm a bit lost about how to approach using it. I'd like to avoid a brute-force guessing (trial and error) approach, but the documentation between Spark Platform and what's in this repo is just too different to be really helpful.

Could someone please provide a straight forward approach to getting all property data for an MLS using only a username (user.example) and access token (abc_xxx_123), using the sparkplatform API URL (https://sparkapi.com/Reso/OData) ?

Or, explain what else is required?

Thanks in advance!

Does not comply with psr-4 autoloading standard

Does not comply with psr-4 autoloading standard

Composer returns the following error: Deprecation Notice: Class RESO\RESO located in ./vendor/reso/reso-php/lib/Reso.php does not comply with psr-4 autoloading standard. It will not autoload anymore in Composer v2.0. in phar:///usr/local/bin/composer/src/Composer/Autoload/ClassMapGenerator.php:201

Warning indicates that package will not autoload in Composer v2.0, but I'm running v1.10.6 and I still can't get it to autoload.

Steps to Reproduce

  1. Install package composer require reso/reso-php
  2. Run composer dump-autoload --optimize
  3. Call require_once('/path/to/vendor/autoload.php');
  4. Returns Fatal error: Uncaught Error: Class 'RESO\RESO' not found

Expected behavior: Autoload package and make Classes accessible.

Actual behavior: Autoload runs without package and Classes are inaccessible.

Versions

RESO-WebAPI-Client-PHP v1.0
Composer V.1.10.6
PHP v7.3.11

Best Practice Question...

Just curious about is a best practice when working with Reso ( I'm developing for a US client that want an mls implementation )

Is better to ?
a. Import all listings in the local database (and have a sync cron job once every x hours ) and use for display & search the local CMS
or
b. Integrate the Reso APi in website CMS (for showing listings , do searches . etc )

Thank you

RESO Web Example Fails in Util.php

RESO Web Example Fails in Util.php

Description

Failure in /examples/web-example/index.php.
Suspected _config.php issue.

Steps to Reproduce

Run:

https://re124.com/RESO/examples/web-example/index.php

Expected behavior: Log in confirmation; possibly access token.

Actual behavior: 1. Unzipped github samples.
2. Set up in GoDaddy directories.
3. PHP, curl, etc., all active.
4. Set _config as follows:

  1. Ran .../examples/web-example/index.php
    from my directory.

  2. Got login screen with my creds pre-filled.

  3. Clicked "Login".

  4. Error log:

[09-Sep-2019 22:55:23 UTC] PHP Fatal error: Uncaught Error: Call to a member function getAttribute() on null in /home/peterwerrenrath1/public_html/SREIS_SEARCH_ENGINE/RESO/lib/Util/Util.php:77
Stack trace:
#0 /home/peterwerrenrath1/public_html/SREIS_SEARCH_ENGINE/RESO/lib/OpenIDConnect.php(43): RESO\Util\Util::extractFormParameters('...')
#1 /home/peterwerrenrath1/public_html/SREIS_SEARCH_ENGINE/RESO/examples/web-example/index.php(61): RESO\OpenIDConnect::authorize('SMARTREIS', 'n39DWP?L', 'https://openid....', 'ODataApi')
#2 {main}
thrown in /home/peterwerrenrath1/public_html/SREIS_SEARCH_ENGINE/RESO/lib/Util/Util.php on line 77

  1. Unclear how to resolve. Suspect _config.php file issue.

Reproduces how often: Every time.

Versions

PHP logo
PHP Version 7.1.30
System Linux p3plcpnl0649.prod.phx3.secureserver.net 2.6.32-954.3.5.lve1.4.66.el6.x86_64 #1 SMP Thu Jun 20 11:00:35 EDT 2019 x86_64
Build Date Jul 4 2019 18:09:57
Configure Command './configure' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib64' '--libexecdir=/usr/libexec' '--sharedstatedir=/var/lib' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--build=x86_64-redhat-linux-gnu' '--host=x86_64-redhat-linux-gnu' '--target=x86_64-redhat-linux-gnu' '--program-prefix=' '--prefix=/opt/alt/php71' '--exec-prefix=/opt/alt/php71' '--bindir=/opt/alt/php71/usr/bin' '--sbindir=/opt/alt/php71/usr/sbin' '--sysconfdir=/opt/alt/php71/etc' '--datadir=/opt/alt/php71/usr/share' '--includedir=/opt/alt/php71/usr/include' '--libdir=/opt/alt/php71/usr/lib64' '--libexecdir=/opt/alt/php71/usr/libexec' '--localstatedir=/var' '--with-curl=/opt/alt/curlssl/usr' '--sharedstatedir=/usr/com' '--mandir=/opt/alt/php71/usr/share/man' '--infodir=/opt/alt/php71/usr/share/info' '--cache-file=../config.cache' '--with-libdir=lib64' '--with-config-file-path=/opt/alt/php71/etc' '--with-config-file-scan-dir=/opt/alt/php71/link/conf' '--disable-debug' '--enable-calendar' '--enable-exif' '--enable-ftp' '--enable-gd-native-ttf' '--enable-huge-code-pages' '--enable-opcache' '--enable-opcache-file' '--enable-shmop' '--enable-xml' '--with-bz2' '--with-freetype-dir=/usr' '--with-gettext' '--with-gmp' '--with-iconv' '--with-jpeg-dir=/usr' '--with-kerberos' '--with-layout=GNU' '--with-libxml-dir=/opt/alt/libxml2/usr' '--with-mhash' '--with-openssl-dir=/opt/alt/openssl' '--with-openssl=/opt/alt/openssl' '--with-pcre-regex=/opt/alt/pcre/usr' '--with-pic' '--with-png-dir=/usr' '--with-readline' '--with-t1lib=/opt/alt/t1lib/usr' '--with-webp-dir=/usr' '--with-xpm-dir=/usr' '--with-zlib' '--with-zlib-dir=/usr' '--without-gdbm' '--without-pear' '--with-pcre-jit' '--enable-pcntl' '--with-litespeed' '--with-recode=shared,/usr' '--without-mysqli' '--disable-mbstring' '--disable-bcmath' '--disable-dba' '--disable-dom' '--disable-fileinfo' '--disable-json' '--disable-intl' '--disable-pdo' '--disable-phar' '--disable-posix' '--disable-soap' '--disable-sockets' '--disable-sysvsem' '--disable-sysvshm' '--disable-sysvmsg' '--disable-wddx' '--disable-xmlreader' '--disable-xmlwriter' '--disable-zip' '--without-gd' '--without-imap' '--without-xmlrpc' '--without-xsl' '--without-ldap' '--without-pgsql' '--without-snmp' '--without-mcrypt' '--without-tidy' '--without-enchant' '--without-recode' '--without-mssql' '--without-pspell' '--without-unixODBC' 'build_alias=x86_64-redhat-linux-gnu' 'host_alias=x86_64-redhat-linux-gnu' 'target_alias=x86_64-redhat-linux-gnu'
Server API LiteSpeed V7.4.3
Virtual Directory Support disabled
Configuration File (php.ini) Path /opt/alt/php71/etc
Loaded Configuration File /opt/alt/php71/etc/php.ini
Scan this dir for additional .ini files /opt/alt/php71/link/conf
Additional .ini files parsed /opt/alt/php71/link/conf/alt_php.ini
PHP API 20160303
PHP Extension 20160303
Zend Extension 320160303
Zend Extension Build API320160303,NTS
PHP Extension Build API20160303,NTS
Debug Build no
Thread Safety disabled
Zend Signal Handling enabled
Zend Memory Manager enabled
Zend Multibyte Support provided by mbstring
IPv6 Support enabled
DTrace Support disabled
Registered PHP Streams https, ftps, compress.zlib, compress.bzip2, php, file, glob, data, http, ftp, phar
Registered Stream Socket Transports tcp, udp, unix, udg, ssl, sslv3, tls, tlsv1.0, tlsv1.1, tlsv1.2
Registered Stream Filters zlib., bzip2., convert.iconv., string.rot13, string.toupper, string.tolower, string.strip_tags, convert., consumed, dechunk, mcrypt., mdecrypt.

curl
cURL support enabled
cURL Information 7.62.0
Age 4
Features
AsynchDNS Yes
CharConv No
Debug No
GSS-Negotiate No
IDN No
IPv6 Yes
krb4 No
Largefile Yes
libz Yes
NTLM Yes
NTLMWB Yes
SPNEGO Yes
SSL Yes
SSPI No
TLS-SRP No
HTTP2 Yes
GSSAPI Yes
KERBEROS5 Yes
UNIX_SOCKETS Yes
PSL No
Protocols dict, file, ftp, ftps, gopher, http, https, imap, imaps, ldap, ldaps, pop3, pop3s, rtsp, scp, sftp, smb, smbs, smtp, smtps, telnet, tftp
Host x86_64-redhat-linux-gnu
SSL Version OpenSSL/1.0.2k
ZLib Version 1.2.3
libSSH Version libssh2/1.8.0

json
json support enabled
json version 1.5.0

mbstring
Multibyte Support enabled
Multibyte string engine libmbfl
HTTP input encoding translation disabled
libmbfl version 1.3.2
oniguruma version 5.9.6

dom
DOM/XML enabled
DOM/XML API Version 20031129
libxml Version 2.9.4
HTML Support enabled
XPath Support enabled
XPointer Support enabled
Schema Support enabled
RelaxNG Support enabled

Additional Information

Not using Composer. Relying on Init.php in GoDaddy environment. PHP, curl, json, mbstring and DOM are all installed (see Versions, above).

Accept-Encoding as Request Header

Accept-Encoding as Request Header

This library is sending only Accept and Authentication params as Header of the Request::request(). Some API providers like MLSGrid need to send more params (like Accept-Encoding) as a Header.

New to this

Where would I get the variables
YOUR_CLIENT_ID
YOUR_CLIENT_SECRET

Thanks!

Fatal error: Uncaught RESO\Error\Api: RESO\OpenIDConnect::requestAccessToken()

< Fatal error: Uncaught RESO\Error\Api: RESO\OpenIDConnect::requestAccessToken() >

I downloaded the class as referenced on : https://trestle-documentation.corelogic.com/webapi-libraries.html#php

I decided to test out example-cli.php
rets/examples/cli-example/example-cli.php

I placed the values in config.php

// API authentication URL
$api_auth_url = "https://trestle.corelogic.com/BKR/Connections";

// API token URL
$api_token_url = "https://api-prod.corelogic.com/trestle/oidc/connect/token";

// API data request (web) URL
$api_request_url = "https://api-prod.corelogic.com/trestle/odata/";

$auth_username = I placed the login user here

// API password
$auth_password = I placed the login password here

$client_id = "e89d3c24_beaf_4fed_84d1_9ffa0df39f2d";

$client_secret = "8e7407419ad0443887dc5fdd9c279941";

// Redirect URI
$redirect_uri = "https://www.thedentallist.com/rets";

// Scope
$scope = "WebAPI";

if(file_exists(dirname(FILE)."/_config.php")) {
require_once(dirname(FILE) . "/_config.php");
}

I am testing example-cli.php via the link below

Link : https://thedentallist.com/rets/examples/cli-example/example-cli.php

Error

#!/usr/bin/env php [2023-01-04T01:10:35+00:00] Setting RESO API client id to 'e89d3c24_beaf_4fed_84d1_9ffa0df39f2d'. [2023-01-04T01:10:35+00:00] Setting RESO API client secret. [2023-01-04T01:10:35+00:00] Setting RESO API auth URL to 'https://trestle.corelogic.com/BKR/Connections'. [2023-01-04T01:10:35+00:00] Setting RESO API token URL to 'https://api-prod.corelogic.com/trestle/oidc/connect/token'. [2023-01-04T01:10:35+00:00] Setting RESO API request URL to 'https://api-prod.corelogic.com/trestle/odata/'. [2023-01-04T01:10:35+00:00] Initiating RESO API authorization. [2023-01-04T01:10:36+00:00] Sending authorization request to retrieve access token. [2023-01-04T01:10:36+00:00] EXCEPTION: Failed to obtain access token.
Fatal error: Uncaught RESO\Error\Api: Failed to obtain access token. in /var/www/vhosts/thedentallist.com/httpdocs/rets/lib/OpenIDConnect.php:132 Stack trace: #0 /var/www/vhosts/thedentallist.com/httpdocs/rets/examples/cli-example/example-cli.php(24): RESO\OpenIDConnect::requestAccessToken() #1 {main} thrown in /var/www/vhosts/thedentallist.com/httpdocs/rets/lib/OpenIDConnect.php on line 132

Any suggestions

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.