Without using forms and hidden variables, how to send
variables from a PHP script to another URL using POST
method?
Answer Posted / lakhan lal
you can do it using curl
example:
<?
$URL="www.mysite.com/test.php";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"https://$URL");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch,
CURLOPT_POSTFIELDS, "Data1=blah&Data2=blah");curl_exec
($ch);
curl_close ($ch);
?>
Is This Answer Correct ? | 5 Yes | 2 No |
Post New Answer View All Answers
What is cookie and why do we use it?
Tell me how can we define a variable accessible in functions of a php script?
What is the meaning of "enctype= multipart/form-data" ?
What is meant by variable variables in php?
What is explode() in php?
Tell me what is the meaning of a final class and a final method?
What are the differences between mysqli_connect and mysqli_pconnect?
What are getters and setters php?
What is the use of imagetypes() method?
Tell me what type of operation is needed when passing values through a form or an url?
How to test if a variable is an array?
Do you know what is the function func_num_args() used for?
Name some of the constants in php and their purpose.
How can you upload a file using php?
What is php and features of php?