开发者

Is there a way to do a post in PHP

I am trying to do a simple post to facebook, I got same sample to do a postcode and I changed it a little.

I get the following error

Parse error: syntax error, unexpected ';' in /home/consult/public_html/projects/facebook/index.php on line 13

the line is

'access_token'=>;urlencode($code),

the 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=&gt;$value) { $fields_string .= $key.'='.$value.'&amp;'; }
rtrim($fields_string,'&amp;');

//open connection
$ch = curl_init();

//set the url, number of POST vars, POST data
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_P开发者_C百科OST,count($fields));
curl_setopt($ch,CURLOPT_POSTFIELDS,$fields_string);

//execute post
// $result = curl_exec($ch);

//close connection
curl_close($ch);


?>


it should be

  'access_token'=>urlencode($code),

not

 'access_token'=>;urlencode($code),

also,

'message'=>;urlencode($message),

should be

'message'=>urlencode($message),

also,

key=&gt;

should be

key=>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜