Http_redirect() [resolved]

free web hosting
Open Discussion > CONTRIBUTE > Computers > Programming Languages > PHP Programming

Http_redirect() [resolved]

awesomebill61
i am writing a script, and whenever i use this line
CODE
http_redirect("process.cgi");

i get a call to undefined function error for http_redirect().

maybe i am misunderstanding what this function is used for..... when i call it, it will take the user to the page indicated... in my case "process.cgi"
that was my interpretation of it from the page in the php manual.

i am running xampp for windows and php 5.2.1

Reply

jlhaslip
php.net reference page here: http://ca3.php.net/manual/en/function.http-redirect.php

I believe this function requires the PECL Class installed, but I could be wrong. Do you know if you have that in place?
also, do you have any other output PRIOR to this call, since it issues Headers and NOTHING can precede the Header in the page output. Even a blank line sent to the HTML page will cause a problem with Headers being sent.

You may require a different function. Here is a sample of a re-direct that I use. It builds the re-derict URL from scratch.

CODE
// Start defining the URL.
    $url = 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']);
    // Check for a trailing slash.
    if ((substr($url, -1) == '/') OR (substr($url, -1) == '\\') ) {
        $url = substr ($url, 0, -1); // Chop off the slash.
    }
    $url .= '/index.php'; // Add the page. Change the filename to suit.
    header("Location: $url");
    exit(); // Quit the script.
This was written to redirect within an application. If you need to re-direct to another location on the web, I would suggest another method.

 

 

 


Reply

awesomebill61
bah. yea it says right at the top of the page it is part of PECL... that would be the problem.

thank you for figuring out what my absent-mindedness could not wink.gif

Reply

jlhaslip
Topic is resolved.

Please PM any moderator to continue this discussion. Until then, this topic is closed.

Reply

iGuest
redirect problem
Http_redirect() [resolved]

But how to redirect after using include and require?

The header says error.

Warning: Cannot modify header information - headers already sent by (output started at C:\AppServ\www\aacs\files\headl.Inc:23) in C:\AppServ\www\aacs\klub.Php on line 537

-reply by Asterixs

Reply

iGuest
Re:http_redirect
Http_redirect() [resolved]

Replying to iGuest
You can use this code:

PHPTAGOPEN
Ob_start();
PHPTAGCLOSE

/////
Your code ,include header(location:...);
////

PHPTAGOPEN
Ob_end_flush();
PHPTAGCLOSE

-reply by azade

Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.

Recent Queries:-
  1. php difference http_redirect header - 6.36 hr back. (1)
  2. php pecl http_redirect example - 15.58 hr back. (1)
  3. php call to undefined function http_redirect - 21.51 hr back. (1)
  4. header http_redirect php - 29.44 hr back. (1)
  5. "call to undefined function http_redirect" - 72.22 hr back. (1)
  6. continue with the same session in php when is page is directed from one server to another - 73.70 hr back. (1)
  7. continue with the same session when the browser directs from one page to another in php - 74.07 hr back. (1)
  8. php5 - http_redirect - undefined method - 90.93 hr back. (1)
  9. php http_redirect undefined - 119.79 hr back. (1)
  10. http_redirect undefined - 126.84 hr back. (1)
  11. php simple http_redirect - 130.91 hr back. (1)
  12. http_redirect - 38.81 hr back. (5)
  13. "undefined function http_redirect()" - 131.60 hr back. (2)
  14. how to use http_redirect in php - 131.63 hr back. (1)
Similar Topics

Keywords : http, redirect,

  1. Header Redirect Errors
    (5)
  2. Problem With $http_post_vars
    (3)
    I have a piece of code on one server that works and the same piece of code on another server does
    not. The difference is in the PHP verison & the Linux verison The one that works runs PHP4 on Redhat
    Linux. The one that doesn't runs PHP5 on SUSE Linux. Not sure if this is where the issue lies or
    not. I do know that in one case I see an adrress in searchable and in the other case it is null.
    PHP Code: CODE if ($HTTP_POST_VARS[addr]) {     $searchable =
    $HTTP_POST_VARS[addr];     echo "searchable = ".var_dump(....
  3. Http Authentication Without Using The Popup
    (3)
    As it is mentioned earlier on in this form I am trying to use HTTP authentication to add simple
    users control to my site, one thing I like about it is that the username and password are stored
    throught the entire session that way I don't have to enter into the realm of cookeis and session
    id's. So now I was wondering, a) can I use a standard html forum and place the password and
    username values into $_SERVER and $_SERVER so that they will be reembered throuout the
    session, and /cool.gif' border='0' style='vertical-align:middle' alt='cool.gif' /> ....
  4. Http Authentication
    (2)
    I have a book called PHP and MySQL for dynamic web sites by Larry Ullman, and it's a very good
    book which I would recomend to anyone wanting to learn, but I followed a project in this book, not
    letter by letter, and it won' work. I wrote this code to create an authentication script that
    will only work with one user but allow the credientals to be passed from one page to another. So
    here's the code CODE <?PHP $aut = FALSE;   //Check for user variables if (
    (isset($_server['PHP_AUTH_USER']) AND isset(�....
  5. Problem With Page Redirect
    Help me out with this problem... (8)
    hey ppl, i just wanted a little help...i designed this website, but i want that if i click on
    certain link, it should open new page for few seconds and then browser should automatically redirect
    me to some other page....i tried this with header() function but i couldnt do the wait n redirect
    part, ... so somebody plz help.... -thanx in advance! Thanks Avalon, topic changed. ....
  6. .htaccess Redirect Question
    redirect ALL traffic to another domain (6)
    I want to redirect all my traffic from one site to another domain name. Is this possible, and if so,
    would I do something like this: .htaccess code: CODE redirect 302 /
    http://www.mynewdomain.com Thanks!....
  7. Url Redirection
    redirect a page web to another page (7)
    Hi Is there some functions in php to redirect a page web to another page. thanks....

    1. Looking for http, redirect,

*RANDOM STUFF*





*SIMILAR VIDEOS*
Searching Video's for http, redirect,

*MORE FROM TRAP17.COM*
advertisement



Http_redirect() [resolved]



 

 

 

 

ADD REPLY / Got an Opinion! a humble request :-) RAPID SEARCH! Free Hosting [X]
Express your Opinions, Thoughts or Contribute your information that might help someone here.
Ask your Doubts & Queries to get answers.. "Together, We enlight each other!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE