我正在尝试对Facebook做一个简单的帖子,我有相同的样本来做一个邮政编码,我改变了一点。
我收到以下错误
解析错误:语法错误,意外';'在第13行的/home/consult/public_html/projects/facebook/index.php
该行是
'access_token'=>;urlencode($code),
代码:
<?php
//set POST variables
$url = 'https://graph.facebook.com/arjun/feed';
$code="testing";
$message="Test";
$fields = array(
'access_token'=>;urlencode($code),
'message'=>;urlencode($message),
);
//url-ify the data for the POST
foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; }
rtrim($fields_string,'&');
//open connection
$ch = curl_init();
//set the url, number of POST vars, POST data
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_POST,count($fields));
curl_setopt($ch,CURLOPT_POSTFIELDS,$fields_string);
//execute post
// $result = curl_exec($ch);
//close connection
curl_close($ch);
?>
答案 0 :(得分:2)
应该是
'access_token'=>urlencode($code),
不
'access_token'=>;urlencode($code),
另外,
'message'=>;urlencode($message),
应该是
'message'=>urlencode($message),
另外,
key=>
应该是
key=>