sapna
sapna

Reputation: 11

alchemy api rest api endpoint is giving error 404 not found

i am trying to integrate alchemy api in my project which is in php. before few days everything was working fine but now the rest api endpoint http://access.alchemyapi.com/ which i called in my program is giving error 404 not found please if any can tell why it is giving this error. following is the snippet of code where i have called the rest api

<?php

class AlchemyAPI {

    private $_api_key;
    private $_ENDPOINTS;
    private $_BASE_URL = 'http://access.alchemyapi.com/calls';
*/ 
    public function AlchemyAPI() {
        //Load the API Key from api_key.txt
        $key = trim(file_get_contents("api_key.txt"));
    $this->_api_key = $key;


        //Initialize the API Endpoints

        $this->_ENDPOINTS['sentiment']['url'] = '/url/URLGetTextSentiment';
        $this->_ENDPOINTS['sentiment']['text'] = ' /text/TextGetTextSentiment';
        $this->_ENDPOINTS['sentiment']['html'] = '/html/HTMLGetTextSentiment';

/* rest of the code */ ?>

Upvotes: 0

Views: 787

Answers (1)

Steve
Steve

Reputation: 141

I just cloned the PHP SDK from the AlchemyAPI GitHub repo and was able to run the example just fine. Try running the example with: php example.php

You can also try running the tests with: php tests.php. It calls each API endpoint and that should tell you if one of them is causing an issue.

If that doesn't work, if you have modified the alchemyapi.php file, you can try undoing your changes or perhaps re-cloning the repo. I'm not sure if it's just a copy/paste issue, but it looks like there might be a wayward */ in your code snippet.

Upvotes: 0

Related Questions