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 are the __construct() and __destruct() methods in a php class?
What is boolean in php?
What is put method in php?
What is the use of the function htmlentities?
What is the interface in php?
Define soundex()?
What is mysqli_query?
What is the difference between file_get_contents() and file_put_contents() in php?
What is overriding in php?
How many types of array supported in php?
Why do we use php?
What is chrome logger?
What is the output of the ucwords function in this example?
Why do we use javascript in php?
So if md5() generates the most secure hash, why would you ever use the less secure crc32() and sha1()?