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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T11:31:51+00:00 2026-05-29T11:31:51+00:00

I am creating a plugin that sends a form automatically by using PHP cURL.

  • 0

I am creating a plugin that sends a form automatically by using PHP cURL. Its result is good but the form was not posted by the server. Why is that?

//create array of data to be posted
$post_data['full_name'] = $name;
$post_data['email'] = $email;
$post_data['subscription_type'] = 'E';
$post_data['id'] = $id;

//traverse array and prepare data for posting (key1=value1)
foreach ( $post_data as $key => $value) {
    $post_items[] = $key . '=' . $value;
}

//create the final string to be posted using implode()
$post_string = implode ('&', $post_items);

//create cURL connection
$curl_connection = curl_init($target_url);

//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);

//show information regarding the request
print_r(curl_getinfo($curl_connection));
echo curl_errno($curl_connection).'-'.curl_error($curl_connection);

//close the connection
curl_close($curl_connection);

This is the result of the code.

Array ( 
[url] => http://www.remote-server.com/formcapture.php?v=28&w=29 
[content_type] => text/html 
[http_code] => 200 
[header_size] => 180 
[request_size] => 302 
[filetime] => -1 
[ssl_verify_result] => 0 
[redirect_count] => 0 
[total_time] => 0.742828 
[namelookup_time] => 0.015174 
[connect_time] => 0.062791 
[pretransfer_time] => 0.0628 
[size_upload] => 75 
[size_download] => 6122 
[speed_download] => 8241 
[speed_upload] => 100 
[download_content_length] => 6122 
[upload_content_length] => 75 
[starttransfer_time] => 0.692776 
[redirect_time] => 0 
) 0- 

This is the form that I want to send.

<form class='subscription_form' id='subscription_form' method='POST' action='http://www.remote-server.com/formcapture.php?v=28&w=29'>
<div align='center'><center>
<p>Full name<br><input type='text' name='full_name' size='20'></p>
</center></div>
<div align='center'><center>
<p>E-mail address<br><input type='text' name='email' size='20'></p>
</center></div>
<input type='hidden' name='subscription_type' value='E'><div align='center'><center>
<p><input type='submit' value='Go »'></p>
</center></div>
<input type='hidden' name='id' value='360'>
</form>
  • 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-29T11:31:53+00:00Added an answer on May 29, 2026 at 11:31 am

    Have you tried setting cURL to return the response headers?

    curl_setopt($curl_connection, CURLOPT_HEADER, 1);
    

    This should bring back the headers which you can echo out and use to see what the other server is attually returning.

    Also :

    echo curl_getinfo($curl_connection, CURLINFO_HTTP_CODE);
    

    Should bring back the HTTP response code e.g 200 404 500 etc

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

Sidebar

Related Questions

I need to customize iReport sources.. (not creating plugin) Currently i am using iReport
Using Rails 2.3.11 , I'm creating a plugin for Redmine that add methods to
I'm interested in creating a plugin that does this simple task: Steps 1. User
I'm reading some tutorials now about jQuery.. function creating,plugin creation etc. but these tutorials
I've been using the Maven EAR plugin for creating my ear files for a
I'm creating a plugin project that will have a menu and toolbar item, that
I'm creating a new plugin for a jruby on rails application that will eventually
i am creating a acl controller plugin that checks the if the user is
I'm creating a plugin/bookmarklet that will take an XML document embedded within the <textarea>
I'm creating a browser plugin (bookmarklet) that exacts a large XML document embedded within

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.