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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T14:38:50+00:00 2026-05-30T14:38:50+00:00

I need to send some data from my form in html to webservice. (For

  • 0

I need to send some data from my form in html to webservice. (For do this, i need to do the operation of POST)

I have seen research that I can transmit information using php cURL. But in all examples, i don’t view to send data to webservice, only to file php that print $_POST variable.

I have this webservice: http://192.168.1.1/fastfood/event/attendee (example)
And i try to send data in an array.

For example i try to send: attendee = array( 'name' => $_POST['name'] , 'lastname' => $_POST['lastname'] , 'address' => $_POST['address'] );

Then, the web service takes out the array data. ¿How to do this?

UPDATE 1:

This is my code that i’m doing now… But don’t work 🙁

$name = $_POST['name'];
$lastname = $_POST['lastname'];
$address = $_POST['address'];

$attendee = array(
    'name' => "$name",
    'lastname' => "$lastname",
    'address' => "$address"
);

$url_target = 'http://192.168.1.1/fastfood/event/attendee';
//$header = array('Content type: multipart/form-data');
$user = 'root';
$pass = '123';
$userpasswd = "$user:$pass";

$ch = curl_init($url_target);

    curl_setopt($ch, CURLOPT_POST, TRUE);
    curl_setopt($ch, CURLOPT_USERPWD, $userpasswd);
    //curl_setopt($ch, CURLOPT_URL, $url_target);
    //curl_setopt($ch, CURLOPT_HEADER, TRUE);
    //curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $attendee);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
    curl_setopt($ch, CURLOPT_FRESH_CONNECT, TRUE);
    curl_setopt($ch, CURLOPT_FAILONERROR, TRUE);
    curl_setopt($ch, CURLOPT_TIMEOUT, 30);
    $result = curl_exec($ch);

    $getInfo = curl_getinfo($ch);

curl_close($ch);

The variable $result return me a FALSE, and the variable $getInfo return me a http_code = 500, Content-Type = Null.

Reading the documentation of cURL when i send a data like a array, the content type should be a “multipart/form-data” but, also, don’t work for me.

  • 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-30T14:38:52+00:00Added an answer on May 30, 2026 at 2:38 pm
    // Here is the data we will be sending to the service
      $data = array(
        'name'     => $_POST['name'],
        'lastname' => $_POST['last_name'],
        'address'  => $_POST['address']
      );  
    
    
      $curl = curl_init('http://192.168.1.1/fastfood/event/attendee');
    
    
      curl_setopt($curl, CURLOPT_POST, 1); //Choosing the POST method
      curl_setopt($curl, CURLOPT_URL, 'http://localhost/helloservice.php');  // Set the url path we want to call
      curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);  // Make it so the data coming back is put into a string
      curl_setopt($curl, CURLOPT_POSTFIELDS, $some_data);  // Insert the data
    
      // Send the request
      $result = curl_exec($curl);
    
      // Free up the resources $curl is using
      curl_close($curl);
    
      echo $result;
    

    Written by Chad Lung at GiantFlyingSaucer

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

Sidebar

Related Questions

Hi i need to post some data to a web server from windows phone
I need to send some arguments from the iPhone to a php in the
I'm building a fairly simple PHP script that will need to send some emails
I need to implement some form of communication mechanism in my application, to send
i'm trying to send some radio buttons from a form with ajax, the problem
i have this problem: I have created a bash script that performs some tasks.
I have a form that customers fill in with personal data and also makes
Can anyone tell me the best way to send some xml data from one
I have an application where i need to write some data to the serial
I am developing one iPhone application where I need to send some data (in

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.