facebook - error "array to string conversion" in FacebookCurl.php -
i have error.... "array string conversion" in line 66 in facebookcurl.php, i'm trying update this: custom_image page/tabs/app_id...
i value custom_image input type file , use multipart/form-data....
this code in php...
session_start(); require '/../../vendor/autoload.php'; require '/../config/configfb.php'; use facebook\facebooksession; use facebook\facebookredirectloginhelper; use facebook\facebookrequest; use facebook\facebookresponse; use facebook\graphuser; use facebook\graphobject; use facebook\facebookrequestexception; //app_id , secret facebooksession::setdefaultapplication($config['appid'], $config['secret']); $helper = new facebookredirectloginhelper('xxxxxxxxxx'); try { $session = $helper->getsessionfromredirect(); if($session): $_session['facebook']=$session->gettoken(); header('location: xxxx'); endif; if (isset($_session['facebook'])): $session = new facebooksession($_session['facebook']); if (isset($_post['custom_name'])) { //get value of input type text custom_name $custom_name=$_post['custom_name']; //get value of input type file custom_image $custom_image=$_files['custom_image']; //get access token $request = new facebookrequest($session, 'get', '/me/accounts'); $response = $request->execute(); $getacounts = $response->getgraphobject()->asarray(); foreach ($getacounts['data'] $keyacc) { $keyacc ->id; if($keyacc->id == $page){ $_session['access_token']=$keyacc->access_token; } } $access_token=$_session['access_token']; $session = new facebooksession($access_token); //update custom_name , custom_image $request = new facebookrequest($session, 'post', '/'.$tab, array ( 'custom_name' => $custom_name 'custom_image' => $custom_image ) ); $response = $request->execute(); $graphobject = $response->getgraphobject(); $request = new facebookrequest($session, 'get', '/'.$tab); $response = $request->execute(); $getinf = $response->getgraphobject()->asarray(); $_session['getinf'] = $getinf; } endif; } catch(facebookrequestexception $ex) { // when facebook returns error } catch(\exception $ex) { // when validation fails or other local issues } if ($session) { // logged in }
the error "array string conversion" in line 66 in facebookcurl.php this...
<?php /** * set array of options curl resource * * @param array $options */ public function setopt_array(array $options) { curl_setopt_array($this->curl, $options); }
can me please?
looks in $custom_image
path
image required assigning whole $_files[]
compound array it. try replacing line $custom_image=$_files['custom_image'];
in code this, $custom_image=$_files['custom_image']['tmp_name'];
, see if works
Comments
Post a Comment