Bitly class
Possible Methods
__construct
Default constructor
Parameters
- login string
- The login (username) that has to be used for authenticating
- apiKey string
- The API-key that has to be used for authentication (see http://bit.ly/account)
Return
void
setTimeOut
Set the timeout
After this time the request will stop. You should handle any errors triggered by this.
Parameters
- seconds int
- The timeout in seconds
Return
void
setUserAgent
Set the user-agent for you application
It will be appended to ours, the result will look like: "PHP Bitly/<version> <your-user-agent>"
Parameters
- userAgent string
- Your user-agent, it should look like <app-name>/<app-version>
Return
void
clicks
Grab the statistics about a link
Parameters
- shortURL string (optional)
- refers to a bit.ly URL eg: http://bit.ly/1RmnUT
- hash string (optional)
- refers to a bit.ly hash eg: 1RmnUT
Return
array
clicksByMinute
Given a bit.ly URL or hash, provides time series clicks per minute for the last hour in reverse chronological order (most recent to least recent).
Parameters
- shortURL string (optional)
- Refers to a bit.ly URL eg: http://bit.ly/1RmnUT
- hash string (optional)
- Refers to a bit.ly hash eg: 1RmnUT
Return
array
countries
Provides a list of countries from which clicks on a specified bit.ly short link have originated, and the number of clicks per country.
Parameters
- shortURL string (optional)
- Refers to a bit.ly URL eg: http://bit.ly/1RmnUT
- hash string (optional)
- Refers to a bit.ly hash eg: 1RmnUT
Return
array
expand
Given a bit.ly URL or hash, expand decodes it and returns back the target URL.
Parameters
- shortURL string (optional)
- Refers to a bit.ly URL eg: http://bit.ly/1RmnUT
- hash string (optional)
- Refers to a bit.ly hash eg: 1RmnUT
Return
array
info
This is used to return the page title for a given bit.ly link.
Parameters
- shortURL string (optional)
- Refers to a bit.ly URL eg: http://bit.ly/1RmnUT
- hash string (optional)
- Refers to a bit.ly hash eg: 1RmnUT
Return
array
lookup
This is used to query for a bit.ly link based on a long URL. For example you would use /v3/lookup followed by /v3/clicks to find click data when you have a long URL to start with.
Parameters
- url string
- A long URL to shorten, eg: http://betaworks.com
Return
array
referrers
Provides a list of referring sites for a specified bit.ly short link, and the number of clicks per referrer.
Parameters
- shortURL string (optional)
- Refers to a bit.ly URL eg: http://bit.ly/1RmnUT
- hash string (optional)
- Refers to a bit.ly hash eg: 1RmnUT
Return
array
shorten
For a long URL, shorten encodes a URL and returns a short one.
Parameters
- url string
- A long URL to shorten, eg: http://betaworks.com
- domain string (optional)
- Refers to a preferred domain, possible values are: bit.ly or j.mp.
- endUserLogin string (optional)
- The end users login.
- endUserApiKey string (optional)
- The end users apiKey.
Return
array
isProDomain
This is used to query whether a given short domain is assigned for bitly.Pro, and is consequently a valid shortUrl parameter for other api calls.
Parameters
- domain string
- A short domain.
Return
bool
validate
For any given a bit.ly user login and apiKey, you can validate that the pair is active.
Parameters
- endUserLogin string
- The end users login.
- endUserApiKey string
- The end users apiKey.
Return
bool