LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 08-06-2008, 07:54 PM   #1
syok
LQ Newbie
 
Registered: Jan 2006
Posts: 25

Rep: Reputation: 15
using header('location:...


hello there,
i'm not sure what is wrong.Just a simple application using header

<?php
header('location: http://192.168.80.5/info.php');
?>

save as justinfo.php

when i type 192.168.80.5/justinfo.php from 192.168.80.10 browser will direct me to 192.168.80.5. ok fine. Confirm this with access_log in 192.168.80.5 showed incoming request from 192.168.80.10

but execution in cron job or run as batch does not take place.
example:
/usr/bin/php5 -q justinfo.php will not show any incoming request in access_log


i'm sending get variable to another server triggered by cron job and target server is on windows.
example

<?php
...get record from db
header('location: http://anotherserver/fromme.aspx?var1=$var&var2=$var2');
?>

how to do that?
 
Old 08-06-2008, 10:56 PM   #2
AdaHacker
Member
 
Registered: Oct 2001
Location: Brockport, NY
Distribution: Kubuntu
Posts: 384

Rep: Reputation: 32
Quote:
Originally Posted by syok View Post
/usr/bin/php5 -q justinfo.php will not show any incoming request in access_log
Well, of course it won't. You're directly executing it - it's not running through the web server. All that script does is print out an HTTP header which, if you just run it on the command line like that, is the equivalent of printing "Hello, world" and exiting.

If you want that script to redirect to another server, then you need to request it via HTTP. So instead of directly running it with the PHP CLI interpreter, run it via lynx or wget, e.g. wget http://192.168.80.5/justinfo.php.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
C header file location? Sambojambo Programming 2 02-18-2008 08:45 AM
Location of C Header Files in Fedora Core 5 wadedesk Linux - Software 3 05-11-2006 01:12 AM
header file location ..mach.h .. pashupathinath Programming 1 10-21-2004 06:27 PM
c header files location 2.6.5 kernel? Rhatlinux Linux - Software 1 09-11-2004 03:39 PM
vmware tools install needs c header location molotov Libranet 5 04-28-2004 12:21 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:17 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration