php - How to execute only page URL and redirect to another page? -


i want execute url page redirect requested header location. page not redirect. previous page showing here.

see code-

example.php

<?php function test() {     $aa = 'good morning';     //file_get_content('http://localhost/demoproject/test.php');     $ch = curl_init('http://localhost/demoproject/test.php');     curl_exec($ch);     return $aa; } $text = test(); header('location:http://www.google.co.in/search?q='.urlencode($text)); ?> 

in test.php file have written 1 pdf generated code , email function generate pdf file attachment. want http://localhost/demoproject/test.php execute.

when run example.php file. page redirect http://www.google.co.in/search?q=good+morning showing current page test.php data.

how execute url not retrieve data?

you can have output not sent browser setting option curlopt_returntransfer

$ch = curl_init('http://localhost/demoproject/test.php'); curl_setopt($ch, curlopt_returntransfer, true); curl_exec($ch); 

Comments

Popular posts from this blog

python - Healpy: From Data to Healpix map -

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -