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


Please Help Members By Posting Answers For Below Questions

What's the difference between accessing a class method via -> and via ::?

530


Is php required for wordpress?

506


What is string and its function?

514


What are the advantages of stored procedures, triggers, indexes in php?

502


Does cors prevent csrf?

530






Is it possible to use com component in php?

554


What is the main difference between php 4 and php 5?

533


How to join multiple strings stored in an array into a single string?

510


What is the use of htmlspecialchars in php?

524


Do you know what is use of count() function in php?

517


Do you know what does $globals means?

557


Write down the code for save an uploaded file in php.

530


How is a session id generated?

533


Which is better php praogramming or cad/cam scope wise and also salaray wise?

1574


How does php sessions work?

520