You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Validate the API URL by checking if the API index exists and is parseable,
* as well as forcing SSL for stores that allow it.
*
* @since 2.0
*
* @throws ClientException
*/
publicfunctionvalidate_api_url()
{
$index = @file_get_contents($this->api_url);
// check for HTTP 404 response (file_get_contents() returns false when encountering 404)
// this usually means:
// 1) the store URL is not correct (missing sub-directory path, etc)
// 2) pretty permalinks are disabled
if (false === $index) {
thrownewClientException(sprintf('Invalid URL, no WC API found at %s -- ensure your store URL is correct and pretty permalinks are enabled.', $this->api_url), 404);
}
// older versions of WC (2.0 and under) will simply return a "1"
if ('1' === $index) {
thrownewClientException(sprintf('Please upgrade the WooCommerce version on %s to v2.2 or greater.', $this->api_url));
}
// strip invalid leading/trailing characters from JSON