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's the difference between accessing a class method via -> and via ::?
Is php required for wordpress?
What is string and its function?
What are the advantages of stored procedures, triggers, indexes in php?
Does cors prevent csrf?
Is it possible to use com component in php?
What is the main difference between php 4 and php 5?
How to join multiple strings stored in an array into a single string?
What is the use of htmlspecialchars in php?
Do you know what is use of count() function in php?
Do you know what does $globals means?
Write down the code for save an uploaded file in php.
How is a session id generated?
Which is better php praogramming or cad/cam scope wise and also salaray wise?
How does php sessions work?