Link to home
Create AccountLog in
Avatar of Shamsul Kamal
Shamsul Kamal

asked on

How to post a form using curl and suppressing the output ?

Hi,

I would like to request an assistant.

May i know how to post the following form using curl without displaying or hidden the output ?

My form are as follows :

<form action='http://www.domain.com/secure-backup/templates/internetwebhostingv3/ajaxform/order/create-domain.php' method='post' id='formmynic' >
      <input type='hidden' name='domain_name' value='$domainname'>
      <input type='hidden' name='term' value='$terms'>
      <input type='hidden' name='ns1_skey' value='$nameserver1'>
      <input type='hidden' name='ns2_skey' value='$nameserver2'>
      <input type='hidden' name='contact_category' value='IDV'>
      <input type='hidden' name='reg_contact_code' value>
      <input type='hidden' name='reg_fname' value='$mynic_fname'>
      <input type='hidden' name='reg_lname' value='$mynic_lname'>
      <input type='hidden' name='reg_nickname' value='$mynic_fname'>
      <input type='hidden' name='reg_gender' value='$gender'>
      <input type='hidden' name='reg_race' value='$race'>
      <input type='hidden' name='reg_dob' value='$mynic_dob'>
      <input type='hidden' name='reg_newic' value='$mynic_ic'>
      <input type='hidden' name='reg_oldic' value>
      <input type='hidden' name='reg_addr1' value='$mynic_add1'>
      <input type='hidden' name='reg_addr2' value='$mynic_add2'>
      <input type='hidden' name='reg_addr3' value>
      <input type='hidden' name='reg_postcode' value='$mynic_zip'>
      <input type='hidden' name='reg_city' value='$mynic_city'>
      <input type='hidden' name='reg_state' value='$mynic_province'>
      <input type='hidden' name='reg_country' value='MY'>
      <input type='hidden' name='reg_telephone' value='$mynic_phone'>
      <input type='hidden' name='reg_fax' value>
      <input type='hidden' name='reg_email' value='$mynic_email'>
      <input type='hidden' name='adm_username' value>
      <input type='hidden' name='flag_adm' value='1'>
      <input type='hidden' name='tec_contact_code' value='CPC003850'>
      <input type='hidden' name='flag_tec' value='-'>
      <input type='hidden' name='bil_contact_code' value='CPC003850'>
      <input type='hidden' name='flag_bil' value='-'>
      <input type='hidden' name='create_domain' value='CREATE DOMAIN'>
</form>      


Appreciates anybody assistant.

Thank you.
Avatar of Loganathan Natarajan
Loganathan Natarajan
Flag of India image

It is a usual way to post the hidden field values too to the form like post values. Have you already tried to post the form values? ref. http://www.electrictoolbox.com/php-curl-form-post/
are you talking about using curl in a shell on the client?
    curl --data create_domain=CREATE DOMAIN --data bil_contact_code=CPC003850 ... http:/.... > /dev/null

or are you talking about using curl from within your web application which receives the request from above form?
yes, you can automatic execute the above script into cron also
You can suppress output from any PHP script with output buffering.  Use ob_start() at the beginning of the script and use ob_end_clean() at the end of the script.  No output will occur, even if the script issues messages.  However if the script fails to execute the ob_end_clean() function call, output may occur.  I have not tested the solution posted here, but it looks like it might be worth a try.
http://www.php.net/manual/en/function.ob-end-clean.php#85014
ASKER CERTIFIED SOLUTION
Avatar of Ray Paseur
Ray Paseur
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer