Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7857139
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T20:56:32+00:00 2026-06-02T20:56:32+00:00

edit: <?php $file= ‘fbplus.jpg’; $args = array( ‘message’ => $album_message, ); $args[basename($file)] = ‘@’

  • 0

edit:

<?php
    $file= 'fbplus.jpg';

    $args = array(
       'message' => $album_message,
    );
    $args[basename($file)] = '@' . realpath($file);
    $ch = curl_init();
    $url = $graph_url;
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_HEADER, false);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $args);
    $data = curl_exec($ch);
    //returns the photo id
    print_r(json_decode($data,true));


    echo "$data['id'] "; //wont work
        echo "$data[id] "; //wont work


?>

this was the return, after i successfully uploaded a photo.

Array ( [id] => 112235735579158 [post_id] => 100003781972892_112203478915717 )

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T20:56:36+00:00Added an answer on June 2, 2026 at 8:56 pm

    curl_exec() returns a string (contents of the webpage), not an Array. So you cannot do $data['id'] because $data is a string and not an array.

    What is the url you are posting to? What is its exact output?

    EDIT: Looks like the url returns JSON. In that case:

    <?php
        $file= 'fbplus.jpg';
    
        $args = array(
           'message' => $album_message,
        );
        $args[basename($file)] = '@' . realpath($file);
        $ch = curl_init();
        $url = $graph_url;
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_HEADER, false);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_POST, true);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $args);
        $data = curl_exec($ch);
        //returns the photo id
    
        $data = json_decode($data,true);
    
        echo $data['id'];
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to edit my sidebar.php file in my current them WP is using
How i can edit php.ini file from cpanel.I am using putty and vi editor
When I'm using Vim 7.3 to edit a large PHP file (2000 lines), if
I'm trying to create a php file which I can edit straight away without
I'm editing the functions.php file of a WordPress theme and whenever I edit it,
i try to edit the text of an XML file from my page edit.php.
I have the following form in my form.php file: <form action=operation.php?part=dictionary&operation=<?php echo (($_GET['action']=='addword')?'save':'edit&id='.$_GET['id'])?> method=get>
I went to edit this PHP file - it's supposed to generate those captcha
I want to make a script, which could automatic edit a PHP file. For
I'm using Eclipse in Ubuntu to edit PHP files. But, unfortunately, some of these

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.