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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T20:24:53+00:00 2026-05-26T20:24:53+00:00

I am trying to post the content in a file as a param using

  • 0

I am trying to post the content in a file as a param using PHP CURL.

The data gets posted but Zoho opens a blank document instead of the one I’m trying to open.

I believe its because I am providing invalid input the $post_data['content'] variable.

$post_data['content'] = "@/c:/xampp/htdocs/site/a.doc";

Zoho opens a blank document when the content received is empty according to what it says in the ZOHO API.

My code is given below for reference.
<

?php   
        $post_data['content']  = "@/c:/xampp/htdocs/site/a.doc";
        $post_data['apikey']   = '[MY API KEY IS HERE]';
        $post_data['output']   = 'url';
        $post_data['filename'] = "a.doc";
        $post_data['id']       = '12345678';
        $post_data['format']   = "doc";
        $post_data['saveurl']  = 'https://localhost/researchPortal/tmp/save.php';
        $post_data['agentname'] = 'ZRemoteAgent';
        $post_data['mode']   = "normaledit";

        foreach ( $post_data as $key => $value)
        {
            $post_items[] = $key . '=' . $value;
        }

        $post_string = implode ('&', $post_items);



    //create cURL connection
$curl_connection =  curl_init('https://exportwriter.zoho.com/remotedoc.im');

//set options
curl_setopt($curl_connection, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($curl_connection, CURLOPT_USERAGENT,  "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)");
curl_setopt($curl_connection, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl_connection, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl_connection, CURLOPT_FOLLOWLOCATION, 1);

//set data to be posted
curl_setopt($curl_connection, CURLOPT_POSTFIELDS, $post_string);

//perform our request
$result = curl_exec($curl_connection);

                echo $result;

//close the connection
curl_close($curl_connection);

?>
  • 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-05-26T20:24:53+00:00Added an answer on May 26, 2026 at 8:24 pm

    My guess would be change

    curl_setopt($curl_connection, CURLOPT_POSTFIELDS, $post_string);

    to

    curl_setopt($curl_connection, CURLOPT_POSTFIELDS, $post_data);

    Im guessing converting it into a string is making curl not upload the file with the magic @
    http://dtbaker.com.au/random-bits/uploading-a-file-using-curl-in-php.html

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

Sidebar

Related Questions

I'm trying to post to WordPress using curl via PHP - I'm posting using
I am trying to pass a json data as param for cURL POST. However,
I'm trying to POST a http request using ajax, but getting a response from
I am trying to post some content to my google buzz account using google
I'm trying to post 2 fields, id and data, to a servlet using HttpClient.
I am trying to render content generated by a php file in [jQuery Colorbox][1]
I'm trying to post multipart content (a file and some strings) to a Sinatra
I'm trying to upload some videos using PHP. But I can't get them into
Anyone know how to post file using curl to the google documents. I write
I have a form which sends data to a text file, but I'm trying

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.