I have a PHP that after performing an operation it calls an external URL and returns the value of this external URL, using curl_exec.
However, I need to pass a parameter to this new url, preferably as a session. How can I pass this parameter which in this case is:
$transactionReference
Follow my code:
echo 'codigo da transação: '.$transactionReference;
// chama a url de geração da nota fiscal
// create a new cURL resource
$ch = curl_init();
// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, "http://nhaac.com/envianfe.php");
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $transactionReference);
// grab URL and pass it to the browser
curl_exec($ch);
// close cURL resource, and free up system resources
curl_close($ch);
Just to illustrate the other PHP that this call does is like this:
<?php
session_start();
require 'conexao.php';
if($transactionReference):
echo 'codigo do fornecedor já no nfe: '.$transactionReference;
endif;
require_once ('client-php/lib/init.php');
echo 'codigo do fornecedor já no nfe: '.$transactionReference;
..
..
..
..
..
Maybe this is where I'm not sure how to get the variable.