Receiving data from php curl to another php file -
i trying send data 1 php file on webserver webserver using curl, unsure how access data sent second webserver work. able access data before using $_post array curl being used send data no longer able use reason. can point me in right direction on how access data?
function post_to_url($url, $data) { $fields = ''; foreach($data $key => $value) { $fields .= $key . '=' . $value . '&'; } rtrim($fields, '&'); //dl: ugh. $post = curl_init(); curl_setopt($post, curlopt_url, $url); curl_setopt($post, curlopt_post, count($data)); curl_setopt($post, curlopt_postfields, $fields); curl_setopt($post, curlopt_returntransfer, 1); $result = curl_exec($post); curl_close($post); }
that code using curl post itself, here receiving end $username = $_post['email'];
if using curl make sure post:
curl_setopt($ch, curlopt_post, 1); curl_setopt($ch, curlopt_postfields, $array());
Comments
Post a Comment