Jump to content
Дизайн и модификация Invision Community IPBSkinsBETA
Search In
  • More options...
Find results that contain...
Find results in...
Sign in to follow this  
Louis

API

Recommended Posts

Добрый вечер!

Можете помочь пожалуйста, как построить GET запрос на работу с API Форума ? Не получается не как это сделать 

Share this post


Link to post

Для начало нужно создать API ключ в АЦ -> System -> REST and OAuth -> API Keys
Дальше при запросе использовать его как логин для basic аутентификации.

На curl-е это будет выглядеть так

$communityUrl = 'http://forum.ru/';
$apiKey = '082e2b893312d7c07e295bbadc55eb4c';
	
$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;

 

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...