Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'pr-166'

  • Loading branch information...
commit 912dd7a43d9f7aacccb842de62df05e5ac1e4d2d 2 parents 751fb8a + d5c1cb2
@jmathai authored
Showing with 18 additions and 3 deletions.
  1. +18 −3 EpiTwitter.php
View
21 EpiTwitter.php
@@ -18,10 +18,15 @@ class EpiTwitter extends EpiOAuth
protected $accessTokenUrl = 'https://api.twitter.com/oauth/access_token';
protected $authorizeUrl = 'https://api.twitter.com/oauth/authorize';
protected $authenticateUrl= 'https://api.twitter.com/oauth/authenticate';
- protected $apiUrl = 'https://api.twitter.com';
+ protected $apiUrl = 'http://api.twitter.com';
protected $userAgent = 'EpiTwitter (http://github.com/jmathai/twitter-async/tree/)';
- protected $apiVersion = '1.1';
+ protected $apiVersion = '1';
protected $isAsynchronous = false;
+ /**
+ * The Twitter API version 1.0 search URL.
+ * @var string
+ */
+ protected $searchUrl = 'http://search.twitter.com';
/* OAuth methods */
public function delete($endpoint, $params = null)
@@ -55,6 +60,11 @@ public function post_basic($endpoint, $params = null, $username = null, $passwor
return $this->request_basic('POST', $endpoint, $params, $username, $password);
}
+ public function useApiUrl($url = '')
+ {
+ $this->apiUrl = rtrim( $url, '/' );
+ }
+
public function useApiVersion($version = null)
{
$this->apiVersion = $version;
@@ -101,7 +111,12 @@ public function __call($name, $params = null/*, $username, $password*/)
private function getApiUrl($endpoint)
{
- return "{$this->apiUrl}/{$this->apiVersion}{$endpoint}";
+ if ($this->apiVersion === '1' && preg_match('@^/search[./]?(?=(json|daily|current|weekly))@', $endpoint))
+ {
+ return $this->searchUrl.$endpoint;
+ }
+
+ return $this->apiUrl.'/'.$this->apiVersion.$endpoint;
}
private function request($method, $endpoint, $params = null)
Please sign in to comment.
Something went wrong with that request. Please try again.