【发布时间】:2017-06-08 09:29:20
【问题描述】:
我想在 PHP 中使用 Instagram API,但它显示错误:
Fatal error: Uncaught Error: Call to undefined function sendPostData() in /storage/h11/133/1908133/public_html/index.php:13 Stack trace: #0 {main} thrown in /storage/h11/133/1908133/public_html/index.php on line 13
我的代码:
<html>
<head>
<title>indexer</title>
</head>
<body>
</body>
</html>
<?php
$access = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
$user_id = 'xxxxxxxx';
$url= 'https://api.instagram.com/v1/users/'.$user_id.'/relationship?access_token='.$access;
$data = 'action=follow';
$resultObj = json_decode(sendPostData($url,$data));
print_r($resultObj);
?>
【问题讨论】:
-
您的作用域中没有
sendPostData函数。没有此类名称的内置函数。 -
我认为你必须在 php 中使用 curl 来获取 rest api。
-
如何在 php 中 curl ?
标签: php json instagram-api