Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/265.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
我能';我不理解Pinterest API PHP的逻辑_Php_Api_Pinterest - Fatal编程技术网

我能';我不理解Pinterest API PHP的逻辑

我能';我不理解Pinterest API PHP的逻辑,php,api,pinterest,Php,Api,Pinterest,我需要写一个脚本,自动将PIN从本地LAMP服务器发送到我的Pinterest帐户 require 'vendor/autoload.php'; // include Composer's autoloader use DirkGroenen\Pinterest\Pinterest; $pinterest=new Pinterest('*my client id*','*my*app*secret*'); $loginurl=$pinterest->auth->getLogin

我需要写一个脚本,自动将PIN从本地LAMP服务器发送到我的Pinterest帐户

require 'vendor/autoload.php'; // include Composer's autoloader

use DirkGroenen\Pinterest\Pinterest;

$pinterest=new Pinterest('*my client id*','*my*app*secret*');

$loginurl=$pinterest->auth->getLoginUrl('https://127.0.0.1', array('read_public'));
echo '<a href=' . $loginurl . '>Authorize Pinterest</a>';
需要“vendor/autoload.php”;//包括作曲家的自动加载器
使用DirkGroenen\Pinterest\Pinterest;
$pinterest=新pinterest(“*我的客户端id*”、“*我的*应用程序*机密*”);
$loginurl=$pinterest->auth->getLoginUrl('https://127.0.0.1,数组('read_public');
回声';
我想我需要授权才能执行一些操作,例如制作PIN,但是如果没有
重定向_URI
,授权方法就无法工作。我不需要任何重定向。我刚刚计划在下面插入一个代码,它将创建PIN

我应该执行哪些步骤通过PHP脚本发布pin? 我应该使用重定向到另一个PHP脚本来执行我想要的操作吗?
通过PHP脚本发布pin需要执行哪些步骤?

Pinterest使用OAuth 2.0验证应用程序和用户之间的请求

$loginurl var包含URL,要进行授权,您需要单击此URL并进行授权,然后才能发布


未经授权,您无法自动执行此操作,您需要重定向Pinterest将发送令牌的url

我很确定,在您可以在Pinterest上创建任何内容之前,您需要授权用户。看起来他们正在使用OAUTH,那么
重定向\u uri
就是授权的一部分。当您授权用户时,它会将用户重定向到pinterest(以便用户可以自己对其进行身份验证),如果身份验证成功,用户将使用该重定向uri重定向回您的站点。因此,如果没有重定向uri,pinterest将不知道将用户发送到哪里。