Skip to content

Use oAuth with getExpose() #42

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 20 additions & 8 deletions Immocaster/Immobilienscout/Rest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
session_start();
// session_start();
/**
* ImmobilienScout24 PHP-SDK
* Nutzung der ImmobilienScout24 API per REST.
Expand Down Expand Up @@ -342,13 +342,25 @@ private function _geoService($aArgs)
* @param array $aArgs
* @return mixed
*/
private function _getExpose($aArgs)
{
$aRequired = array('exposeid');
$req = $this->doRequest('search/v1.0/expose/'.$aArgs['exposeid'],$aArgs,$aRequired,__FUNCTION__);
$req->unset_parameter('exposeid');
return parent::getContent($req);
}
private function _getExpose($aArgs)
{
$aRequired = array('username','exposeid');
$oToken = null;
$sSecret = null;
if(!isset($aArgs['username']))
{
$aArgs['username'] = $this->_sDefaultUsername;
}
list($oToken, $sSecret) = $this->getApplicationTokenAndSecret($aArgs['username']);
if($oToken === NULL || $sSecret === NULL)
{
return IMMOCASTER_SDK_LANG_APPLICATION_NOT_CERTIFIED;
}
$req = $this->doRequest('search/v1.0/expose/'.$aArgs['exposeid'],$aArgs,$aRequired,__FUNCTION__, $oToken);
$req->unset_parameter('exposeid');
$req->unset_parameter('username');
return parent::getContent($req,$sSecret);
}

/**
* Abfrage eines eigenen Exposes (Offer-API)
Expand Down
6 changes: 4 additions & 2 deletions Immocaster/Oauth/OAuth.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@

/* Generic exception class
*/
class OAuthException extends Exception {
// pass
if (!class_exists('OAuthException')) {
class OAuthException extends Exception {
// pass
}
}

class OAuthConsumer {
Expand Down