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 9143767
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T10:06:22+00:00 2026-06-17T10:06:22+00:00

I am trying to post an image to Cheezburger.com with a PHP script, and

  • 0

I am trying to post an image to Cheezburger.com with a PHP script, and return the URL to the user. The post part works fine, I get the links, IDs etc. back in JSON format, but when I run json_decode($var, true) it only gives me the raw JSON back. Here is the string that got fed into the script:

{
    "items": [
        {
            "id": 6980805120,
            "link": "https://api.cheezburger.com/v1/assets/6980805120",
            "created_time": 1358451002,
            "updated_time": 1358451002,
            "media": [
                {
                    "name": "maxW580",
                    "url": "https://i.chzbgr.com/maxW580/6980805120/h89D91707/",
                    "height": 500,
                    "width": 500,
                    "is_animated": false
                },
                {
                    "name": "maxW320",
                    "url": "https://i.chzbgr.com/maxW320/6980805120/h89D91707/",
                    "height": 320,
                    "width": 320,
                    "is_animated": false
                },
                {
                    "name": "square50",
                    "url": "https://i.chzbgr.com/square50/6980805120/h89D91707/",
                    "height": 50,
                    "width": 50,
                    "is_animated": false
                }
            ],
            "title": "JSA, UR WEBSIET IZ AWSUM. URE HIRD!",
            "description": "JSA, UR WEBSIET IZ AWSUM. URE HIRD! -- This image was created by jsa005 from JSiVi using the JSiVi Meme Generator. Try it out at http://jsivi.uni.me!",
            "asset_type_id": 0,
            "share_url": "http://chzb.gr/10Cg1PS"
        }
    ]
}

When I run json_decode($jsonstring, true) on that, $jsonstring being the variable returned by cURL containing the string above, I only get back the string I fed in. I am confused.

$fields = array(
'access_token' => $this->getToken(),
'title' => $title,
'description' => $description,
'content' => $base64data,
'anonymous' => 'true');
$url = 'https://api.cheezburger.com/v1/assets';
$fields_string = http_build_query($fields);
//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);

$jsonstring = json_decode($result, TRUE);
  • 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-17T10:06:23+00:00Added an answer on June 17, 2026 at 10:06 am

    set

    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    

    before running curl_exec($ch); Without it, response is printed directly into your browser, so you are seeing “raw” JSON and $response is boolean value (TRUE or FALSE). See manual page for more details

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to do a simple image POST to a php script through FileMaker
I am trying to receive the url image and post the image into base64
I'm stumped. Trying to post to a php script with NSURLConnection. Been at this
trying to make link to my recent uploaded image <%= link_to (image_tag (post.image_url(:thumb))), post.image.url(:original),
I'm trying to post an image to TwitPic.com using their API. However, I have
Trying to post an image along with wall post was working fine for couple
I am trying to post image to user wall using javascript FB.api. Image is
I am trying to post an image to a Facebook album using a form
I'm trying to convert the following CURL: curl -X POST \ -H Content-Type: image/jpeg
I am trying to post a URL to the server using the Asynchronous type

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.