Invision Community 4: SEO, prepare for v5 and dormant account notifications Matt November 11, 2024Nov 11
Posted July 14, 20204 yr 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>
August 3, 20204 yr Author 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
August 3, 20204 yr Author 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>
August 3, 20204 yr Author 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.
August 3, 20204 yr 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
August 3, 20204 yr 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.
August 5, 20204 yr 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.
August 5, 20204 yr 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