19 Jul, 2018

How to upload the file and post data using curl in php

19 Jul, 2018

Dear Reader, let us we know that “How to upload the file and post data using curl in PHP“. So in this Tutorial, We Learn Step By Step How to upload the file and post the data Process.

When you want to work on Web Services and API‘s and want to POST and Fetch data from another Application/Website then CURL plays a very important role for the same.

In this tutorial, I am going to aware how to post file and data from one domain to another domain. In this tutorial, I am also aware of how to store this in the database.

First, we see Snapshots for our CURL Request form using which we can post data

And you can also see Live Demo by click on bellow Demo button

Step 1:- First of all we need to create the database like “php_demo”

Step 2:- Now create a table “user” in a database using the below SQL code

Step 3:- Now we need to create a config.php file in the root directory

like

http://localhost/php_demo/curl/config.php

and paste the below code

Step 4:- create an index.php file in our project’s root folder like “http://localhost/php_demo/curl/index.php”

 and paste below code

Step 5:- create a post.php file in our project’s root folder like “http://localhost/php_demo/curl/post.php” and paste below code

Step 6:- Now run your project, so we need to type in browser localhost/your_project_name/index.php

like

http://localhost/php_demo/curl/index.php then you can see the result as in below snapshot, you can post data by fill detail in the form

Congratulations you have successfully created How to upload the file and post data using curl in PHP, if you like this post and was helpful for you then share this post on social media and if you have any query then please contact us or comment below, Thanks.

Related Articles
«
»

2 Comments:

  • sayawismo October 19, 2018

    greaaaat, thanks work very well…….

    Reply

    • Webpreparations Team October 19, 2018

      Thank you, dear Reader, for your appreciation.

      Reply

Leave a comment:

Your email address will not be published. Required fields are marked *