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 are the advantages of triggers?

543


Tell me how can we pass the variable through the navigation between the pages?

533


How is a constant defined in a PHP script?

549


Where are the persistent cookies stored on your computer?

583


What is a composer?

542






How is it possible to remove escape characters from a string?

582


What is php namespace?

543


How does html form submit work?

523


How to create a session? How to set a value in session? How to remove data from a session?

518


What is an anti csrf token?

514


What is print_r?

523


How to include variables in double-quoted strings?

515


What is php form validation?

561


How does php work?

548


How to create a session? How to remove data from a session?

528