PHP - Change fopen to curl

azraeldentara

New Member
I use this function with 'fpoen', but I need to use 'curl' instead.\[code\]function rest_auth_xml($url,$method,$token,$chave,$xml){$auth = sprintf('Authorization: Basic %s',base64_encode("$token:$chave") );$opts = array('http'=>array( 'method'=>$method, 'header'=>"Content-Type: text/xml\r\n" . $auth."\r\n", 'content'=>$xml));$context = stream_context_create($opts);/* Sends an http request to www.example.comwith additional headers shown above */$fp = fopen($url, 'r', false, $context);$conteudo = stream_get_contents($fp);fclose($fp);return $conteudo;}\[/code\]If anyone knows how to migrate, send your answer!Than you!
 
Back
Top