How to call another PHP page inside a PHP page

Asked

Viewed 3,134 times

4

Galley,

I have a PHP page and now I need to call another PHP page passing the parameters I collected from my BD.

How can I do that?

I’ve tried that, but it wasn’t!

$qry_str = "id=".$id_mensagem;
$ch      = curl_init();

// Set query data here with the URL
curl_setopt($ch, CURLOPT_URL, '/postar_reenvio.php?' . $qry_str);
//$url = "http://www.google.com/search?q=".$strSearch."&hl=en&start=0&sa=N";

curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 3);
$content = trim(curl_exec($ch));
print_r($content);
curl_close($ch);
  • That you’ve tried to do?

  • $qry_str = "id=". $id_message; $ch = curl_init(); // Set query data here with the URL curl_setopt($ch, CURLOPT_URL, 'postar_resence.php? ' . $qry_str); //$url = "http://www.google.com/search?q=". $strSearch." &hl=en&start=0&sa=N";

curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 3);
$content = trim(curl_exec($ch));
print_r($content);
curl_close($ch);

  • What error occurs?

  • have thought about using include 'postar_resenvio.php' and using the methods of the resend on the current page?

  • I can’t use include because this call will be on a loop

1 answer

1


If I understand your question this should be your solution

   // Obter os recursos de cURL 
    $curl = curl_init();

    curl_setopt_array($curl, array(
        CURLOPT_URL => 'http://testcURL.com/?item1=value&item2=value2'
    ));
    // enviar o request  & guarda a resposta em $resp
    $resp = curl_exec($curl);
    // fechar o request
    curl_close($curl);

Browser other questions tagged

You are not signed in. Login or sign up in order to post.