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 difference between overloading and overriding in oops?
How to remove the new line character from the end of a text line in php?
Which library is used in php to do various types of image work?
What is the difference between javascript and php?
What is null value in php?
How would you open a directory for reading in php?
Will react hooks replace redux?
Tell us how can we access the data sent through the url with the post method?
What is encapsulation in php?
What is variable function php?
List the different types of print functions available in php?
What is faster in php?
Write a program to show the joining of two strings in php?
How error handling is being handled by php?
Is it possible to destroy a cookie?