Invision Community 4: SEO, prepare for v5 and dormant account notifications By Matt Monday at 02:04 PM
dtwood01 Posted July 14, 2020 Posted July 14, 2020 I'm attempting to make a basic call to the api using the example code found in the documentation, and I'm not seeing anything resulting in the php echo. Can someone point me in the right direction? I have a basic grasp of php. I also am sure that the api key has access to api/core/hello as set in the AdminCP. <?php $communityUrl = 'https://www.poolspaforum.com/forum/'; $apiKey = 'myapikey'; $curl = curl_init( $communityUrl . 'api/core/hello' ); curl_setopt_array( $curl, array( CURLOPT_RETURNTRANSFER => TRUE, CURLOPT_HTTPAUTH => CURLAUTH_BASIC, CURLOPT_USERPWD => "{$apiKey}:" ) ); $response = curl_exec( $curl ); echo $response; ?> <h1>Hi</h1>
dtwood01 Posted August 3, 2020 Author Posted August 3, 2020 Just want to bump this. I'm still having issues and not sure where I'm going wrong. I'm following the instructions found here:https://invisioncommunity.com/developers/rest-api
bfarber Posted August 3, 2020 Posted August 3, 2020 See if there are any curl errors https://www.php.net/curl_error
dtwood01 Posted August 3, 2020 Author Posted August 3, 2020 Thank you for the response. I'm receiving no curl errors with the below. <?php $communityUrl = 'http://poolspaforum.com/forum/api'; $apiKey = 'mtapikey'; $curl = curl_init( $communityUrl . '/core/members' ); curl_setopt_array( $curl, array( CURLOPT_RETURNTRANSFER => TRUE, CURLOPT_HTTPAUTH => CURLAUTH_BASIC, CURLOPT_USERPWD => "{$apiKey}:" )); if(curl_exec($curl) === false){ echo 'Curl error: ' . curl_error($curl); }else{ echo 'Operation completed without any errors'; } $response = curl_exec( $curl ); ?> <h1>Hi</h1> <p><?php echo $response; ?></p>
dtwood01 Posted August 3, 2020 Author Posted August 3, 2020 I'm receiving the following in my response. My community url is correct, is that not the right path for /core/members? Not Found The requested URL was not found on this server. Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
CoffeeCake Posted August 3, 2020 Posted August 3, 2020 26 minutes ago, dwood@bigfishpublications.com said: I'm receiving the following in my response. My community url is correct, is that not the right path for /core/members? Not Found The requested URL was not found on this server. Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request. Are you sure your path is correct? Your sample code above is pointing to: http://poolspaforum.com/forum/api/core/members You probably intend to land at poolspaforum.com/api/core/members assuming IPB is installed at the root of the domain. Also, do you intent to use https? You should see results once you have the correct address in your browser with something like this example using IPB's site: http://invisioncommunity.com/api/core/hello
CoffeeCake Posted August 3, 2020 Posted August 3, 2020 Poking around, it looks like you have Wordpress at the root of your home page and your base install is at /forum/. I'd take a look at your web server configuration / .htaccess to make sure that the forum/api URL is pointing to IPB and going where it's supposed to go.
bfarber Posted August 5, 2020 Posted August 5, 2020 https://poolspaforum.com/forum/api/core/members This gives a 404 not found response. You may need to inquire with your host as to why if you don't see anything obvious.
Daniel F Posted August 5, 2020 Posted August 5, 2020 Yea, something strange is going on here, the real API gateway ( http://poolspaforum.com/forum/api/index.php ) returns a "pseudo 301" page with the status 200 mentioning that the new url is https://poolspaforum.com/forum/api/core/members
Recommended Posts