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=>$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_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=>
should be
key=>
精彩评论