|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
php-general-digest-help
lists.php.net
Date: Thu Oct 25 2007 - 21:01:16 CDT
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
php-general Digest 26 Oct 2007 02:01:16 -0000 Issue 5092
Topics (messages 263657 through 263680):
Re: Question about time...
263657 by: Daniel Brown
263666 by: tedd
263674 by: Instruct ICC
Re: SMTP
263658 by: Daniel Brown
Maximum function nesting level of '100' reached
263659 by: Sascha Braun
263662 by: Richard Heyes
263663 by: Daniel Brown
Re: mail from
263660 by: Daniel Brown
263673 by: Instruct ICC
Re: MySQL and SVN
263661 by: Emil Edeholt
Re: Slashes, include, AJAX?
263664 by: Nathan Nobbe
263676 by: Rodrigo Poblanno Balp
MPEG Properties
263665 by: Bill Medley
263667 by: Miles Thompson
Comment / Reply function
263668 by: Merlin
show required row first and then other remaining rows
263669 by: Sanjeev N
263671 by: Stephen
263672 by: Andrew Ballard
Re: Ant in php
263670 by: DCVer
Executing PHP
263675 by: Philip Thompson
263677 by: M. Sokolewicz
263679 by: Stut
Re: cant send mail
263678 by: Stut
Re: system command
263680 by: Ronald Wiplinger
Administrivia:
To subscribe to the digest, e-mail:
php-general-digest-subscribe
lists.php.net
To unsubscribe from the digest, e-mail:
php-general-digest-unsubscribe
lists.php.net
To post to the list, e-mail:
php-general
lists.php.net
----------------------------------------------------------------------
attached mail follows:
On 10/25/07, Zoltán Németh <znemeth
alterationx.hu> wrote:
> 2007. 10. 25, csütörtök keltezéssel 09.01-kor Jason Pruim ezt írta:
> > On Oct 24, 2007, at 9:01 PM, tedd wrote:
> >
> > > At 3:10 PM -0700 10/24/07, Instruct ICC wrote:
> > >> > I want to be able to display something like an image of a turkey
> > >>> during the month of november from now until I'm dead.
> > >>
> > >> And how will the application know when you are dead?
> > >
> > > When you stop paying for hosting, the application get's the idea
> > > when it's bits go poof!
> > >
> > > If anyone ever noticed, my web site (http://sperling.com) has a
> > > tree on it that changes with the seasons. I use:
> > >
> > > $dates = getdate();
> > > $month = $dates['mon'];
> > > $w = "http://www.sperling.com/css/seasons/";
> > > switch( $month )
> > > {
> > > case "03": case "04": case "05":
> > > $var = $w . "spring.jpg";
> > > break;
> > > case "06": case "07": case "08" :
> > > $var = $w . "summer.jpg";
> > > break;
> > > case "09": case "10": case "11":
> > > $var = $w . "fall.jpg";
> > > break;
> > > case "12": case "01": case "02":
> > > $var = $w . "winter.jpg";
> > > $break;
> > > }
> > > echo($var);
> > >
> > > And this code is called from within my css file for a background
> > > image. Yes, I use variables in css.
> > >
> > > Cheers,
> > >
> > > tedd
> >
> >
> > Hi tedd,
> >
> > That's actually where I got the idea, just couldn't remember who on
> > what list said they did it :) using variables in css is it as easy as
> > just putting in a quick <?PHP echo "background: $date"; ?> in the
> > css? or is it more complicated?
>
> you have to configure apache to handle css files as php files.
> also you have to send headers including content-type set to text/css
>
> and then you can script your css
>
> greets
> Zoltán Németh
>
> >
> > --
> >
> > Jason Pruim
> > Raoset Inc.
> > Technology Manager
> > MQC Specialist
> > 3251 132nd ave
> > Holland, MI, 49424
> > www.raoset.com
> > japruim
raoset.com
> >
> >
> >
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Or, in the event that you're unable to set MIME types and parsing,
you can just add the appropriate <style></style> tags and then
<? include('css/style.css'); ?>
--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107
Give a man a fish, he'll eat for a day. Then you'll find out he was
allergic and is hospitalized. See? No good deed goes unpunished....
attached mail follows:
At 3:13 PM +0200 10/25/07, Zoltán Németh wrote:
>2007. 10. 25, csütörtök keltezéssel 09.01-kor Jason Pruim ezt írta:
> > That's actually where I got the idea, just couldn't remember who on
>> what list said they did it :) using variables in css is it as easy as
>> just putting in a quick <?PHP echo "background: $date"; ?> in the
>> css? or is it more complicated?
>
>you have to configure apache to handle css files as php files.
>also you have to send headers including content-type set to text/css
>
>and then you can script your css
>
>greets
>Zoltán Németh
That's one way.
Here's another:
http://sperling.com/examples/pcss/
As Zoltán suggested, but didn't elaborate, you
can drop a .htaccess file into your root
directory that contains:
<FilesMatch "\.(css|style)$">
SetHandler application/x-httpd-php
</FilesMatch>
and then use <?php whatever you want ?> inside the css file.
This makes things easier when trying to change
constants like colors, or dealing with the
box-model problem, or rules that are dependant
upon other rules; or really neat automatic image
width/height determinations for images on the fly
(think about that). :-)
There are a lot of opportunities to add
functionality to css that apparently has not been
addressed in any documentation I've been able to
find. I can't be the first down this street, but
for certain it hasn't been traveled often.
Cheers,
tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
attached mail follows:
> >> I want to be able to display something like an image of a turkey
> >> during the month of november from now until I'm dead.
> >
> > And how will the application know when you are dead?
>
> Well, I code all of my applications to receive RFID signals, and I
> had a RFID transmitter embedded into me that gets powered by the
> electricity that my body generates, so when it can no longer get that
> signal, the application is designed to shut down and put up a message
> that says "Due to the death of my creator I quit, have a nice day!" :)
I'm not amused.
http://zeitgeistmovie.com/
Way way way at the end.
_________________________________________________________________
Climb to the top of the charts! Play Star Shuffle: the word scramble challenge with star power.
http://club.live.com/star_shuffle.aspx?icid=starshuffle_wlmailtextlink_oct
attached mail follows:
On 10/25/07, Jens Kleikamp <jens
codes-concepts.com> wrote:
> Diana schrieb:
> > I dont know what I did but now I get this message Failed to connect to
> > mailserver at "localhost" port 25, verify your "SMTP"
> >
> Do you have a smtp server running on localhost?
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Diana,
Try to keep all of the messages in a single thread so that people
searching the archives can benefit from your solution as well.
Check into the following:
1.) Is there an SMTP server running on port 25 on the local machine?
2.) Is there a firewall blocking incoming or outgoing connections
on that port?
3.) Is PHP able to connect to any remote SMTP servers, or by domain name?
--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107
Give a man a fish, he'll eat for a day. Then you'll find out he was
allergic and is hospitalized. See? No good deed goes unpunished....
attached mail follows:
What is the cause for that error:
Fatal error: Maximum function nesting level of '100' reached, aborting!
in /home/Projekte/spectral/modules/xml_mm/classes/xml_mm.class.php on
line 118
Thank you!
Sascha
attached mail follows:
> Fatal error: Maximum function nesting level of '100' reached, aborting!
> in /home/Projekte/spectral/modules/xml_mm/classes/xml_mm.class.php on
> line 118
It seems pretty self explanatory. Do you have a lot of recursion?
--
Richard Heyes
+44 (0)800 0213 172
http://www.websupportsolutions.co.uk
Knowledge Base and HelpDesk software
that can cut the cost of online support
attached mail follows:
On 10/25/07, Sascha Braun <contact.saschabraun
web.de> wrote:
> What is the cause for that error:
>
> Fatal error: Maximum function nesting level of '100' reached, aborting!
> in /home/Projekte/spectral/modules/xml_mm/classes/xml_mm.class.php on
> line 118
[snip!]
It means that PHP reached the maximum level of 100 nested function calls!
Check line 118 of xml_mm.class.php and see what is causing it to
go into an infinite loop. Also, if you have full access to that
server, I'd recommend putting xdebug (by Derick Rethans, who also
posts to this list). It'll create stack traces for you to more
quickly and easily debug your project.
--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107
Give a man a fish, he'll eat for a day. Then you'll find out he was
allergic and is hospitalized. See? No good deed goes unpunished....
attached mail follows:
On 10/25/07, Richard Heyes <richardh
phpguru.org> wrote:
> Richard Heyes wrote:
> >> in my php.ini, I have this set
> >> sendmail_from = admin.intranet
tsanalytics.com
> >>
> >> yet when I do this command :("dcastillo
tsanalytics.com","TEST
> >> MAIL","TESTING MAIL");
> >> I get this message Warning: mail() [function.mail]: "sendmail_from"
> >> not set in php.ini or custom "From:" header missing in
> >> C:\Inetpub\wwwroot\intranet\test.php on line 4
> >
> > And if instead of using the php.ini directive you use the fourth
> > argument to mail()?
> >
> > Eg:
> >
> > <?php
> > mail("dcastillo
tsanalytics.com",
> > "TEST MAIL",
> > "TESTING MAIL",
> > 'admin.intranet
tsanalytics.com');
> > ?>
> >
>
> Oops. That should be:
>
> <?php
> mail("dcastillo
tsanalytics.com",
> "TEST MAIL",
> "TESTING MAIL",
> 'From: admin.intranet
tsanalytics.com');
> ?>
>
> --
> Richard Heyes
> +44 (0)800 0213 172
> http://www.websupportsolutions.co.uk
>
> Knowledge Base and HelpDesk software
> that can cut the cost of online support
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
It sounds like you need to restart IIS to allow the changes to
php.ini to take effect.
--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107
Give a man a fish, he'll eat for a day. Then you'll find out he was
allergic and is hospitalized. See? No good deed goes unpunished....
attached mail follows:
> > in my php.ini, I have this set
> > sendmail_from = admin.intranet
tsanalytics.com
The first thing I'd do is verify if the script is really using the php.ini you think it is by having the script output phpinfo.
_________________________________________________________________
Peek-a-boo FREE Tricks & Treats for You!
http://www.reallivemoms.com?ocid=TXT_TAGHM&loc=us
attached mail follows:
Hi,
Thanks for your answer. Are you sugesting - what I think is called - a
multi-master replication? Since I would like to keep two sources in sync
and want to be able to make changes on both servers. I know very little
about replication. Maybe I'm making a bigger problem of this than it
would have to be.
Best Regards Emil
dordea cosmin wrote:
> consider replication
>
>
Emil wrote:
> I would like to know how you guys handle
> mysql structures between different computers (and for that matter from
> the developer desktop to the stable server).
>
> I work on my home and my office computer with the same php projects. I
> keep all my php files on svn, so I just update and commit the first and
>
> last thing I do when I switch computer. The problem is when I've made a
>
> change in the structure of my mysql tables. I usually try to save a
> dump
> and ssh it to my server and download and import it on the other
> computer. But that feels clumsy, and if I've made changes on both
> computers I have no simple way to merge the structures like I can in
> svn.
>
attached mail follows:
On 10/25/07, Rodrigo Poblanno Balp <balpo
gmx.net> wrote:
>
> Hi everybody!
>
> I'm building a small ajax app which consists of only 3 php files.
>
> index.php which contains all the app and has a couple of links. When a
> link is clicked an Ajax request is sent to the server (using prototype)
> to the
> url central.php with only one parameter 'id'. Depending on that
> parameter, central.php should look for the appropiate content, in this
> case link1.php.
> Then I return a JSON object with the "things" that should be updated on
> index.php
>
> So this is the pseudo-code:
>
> index.php
> <html>...
> <body>
> <a href="" onclick="[send the Ajax request using prototype with the id =
> 1]>Link #1</a>
> <div id="theUpdatableDIV"></div>
> </body>
>
>
> central.php
> <html>...
> <body>
> <?php
> [read the id parameter]
> switch(id){
> case 1: //which is the only case for now!!
> //build the JSON object
> $output = array("title" => "Link #1 Title!",
> "content"=>file_get_contents("link1.php"));//here I read the last file
> which has the content to be updated asynchronously
> return [the JSON object based on $output];
> break;
> }
> ?>
> </body>
>
> link1.php
> <div>Welcome to the content of link #1 which was updated using <a
> href="ajax.org">ajax</a></div>
>
> the JSON object is formed ok, now, my problem is that link1.php outputs
> like this:
>
> <div>Welcome to the content of link #1 which was updated using <a
> href="ajax.org">ajax<\/a><\/div>
>
> So at the moment I update the <div id="theUpdatableDIV"> element on
> index.php, I get no "real" content, but a string with the
> strange slashes.
>
> I've tried:
> stripslashes, ereg_replace, str_replace and strtr to eliminate the
> wierd slashes.
>
> Can anybody tell how to do it right?
how are you building the json object?
i recommend
json_encode(utf8_encode($dataToEncode));
if youre using php5. if youre using php4, try this:
http://mike.teczno.com/JSON/JSON.phps
also, you might want to check out firebug for firefox. it will let you
easily analyze the interaction between the client and server.
also, to verify that the json object youre generating is infact ok;
run it through here:
http://www.jslint.com/
-nathan
attached mail follows:
Nathan Nobbe wrote:
> On 10/25/07, *Rodrigo Poblanno Balp* <balpo
gmx.net
> <mailto:balpo
gmx.net>> wrote:
>
> Hi everybody!
>
> I'm building a small ajax app which consists of only 3 php files.
>
> index.php which contains all the app and has a couple of links. When a
> link is clicked an Ajax request is sent to the server (using
> prototype)
> to the
> url central.php with only one parameter 'id'. Depending on that
> parameter, central.php should look for the appropiate content, in this
> case link1.php.
> Then I return a JSON object with the "things" that should be
> updated on
> index.php
>
> So this is the pseudo-code:
>
> index.php
> <html>...
> <body>
> <a href="" onclick="[send the Ajax request using prototype with
> the id =
> 1]>Link #1</a>
> <div id="theUpdatableDIV"></div>
> </body>
>
>
> central.php
> <html>...
> <body>
> <?php
> [read the id parameter]
> switch(id){
> case 1: //which is the only case for now!!
> //build the JSON object
> $output = array("title" => "Link #1 Title!",
> "content"=>file_get_contents("link1.php"));//here I read the last file
> which has the content to be updated asynchronously
> return [the JSON object based on $output];
> break;
> }
> ?>
> </body>
>
> link1.php
> <div>Welcome to the content of link #1 which was updated using <a
> href=" ajax.org <http://ajax.org>">ajax</a></div>
>
> the JSON object is formed ok, now, my problem is that link1.php
> outputs
> like this:
>
> <div>Welcome to the content of link #1 which was updated using <a
> href="ajax.org <http://ajax.org>">ajax<\/a><\/div>
>
> So at the moment I update the <div id="theUpdatableDIV"> element on
> index.php, I get no "real" content, but a string with the
> strange slashes.
>
> I've tried:
> stripslashes, ereg_replace, str_replace and strtr to eliminate the
> wierd slashes.
>
> Can anybody tell how to do it right?
>
>
> how are you building the json object?
>
> i recommend
> json_encode(utf8_encode($dataToEncode));
>
> if youre using php5. if youre using php4, try this:
> http://mike.teczno.com/JSON/JSON.phps
>
> also, you might want to check out firebug for firefox. it will let you
> easily analyze the interaction between the client and server.
>
> also, to verify that the json object youre generating is infact ok;
> run it through here:
> http://www.jslint.com/
>
> -nathan
>
Hi Nathan,
I'm using php5, and I'm building the JSON object just like that, with
the json_encode.
The problem with using utf_encode apart from the original is that I get
the \n\r for each line in the file read.
Any suggestions?
Thanx
attached mail follows:
Hello, all.
Thanks for your help in advance. I'm trying to figure out how to get PHP to
retrieve MPEG File Properties, specifically the length of the video file in
seconds.
Thanks,
-B
attached mail follows:
Check out ffmpeg-php
http://sourceforge.net/projects/ffmpeg-php/
Miles
On 10/25/07, Bill Medley <spectre_vm
yahoo.com> wrote:
>
> Hello, all.
>
> Thanks for your help in advance. I'm trying to figure out how to get PHP
> to
> retrieve MPEG File Properties, specifically the length of the video file
> in
> seconds.
>
> Thanks,
>
> -B
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
attached mail follows:
Hi there,
I am trying to add a comment functionality to my PHP webapp that
includes a reply possibility on each comment. Like on digg for example.
I am new to AJAX, but would like to take this oportunity and to jump
into cold water with that task now.
I am asking this question here in the PHP forum, as I was thinking to do
a for loop to include a form underneath each comment, but now it sounds
rediculous to me. There must be a smarter way to do this.
My goal is to use JQuery to show and hide a dialog box which contains
the form to reply on the comments.
Basicaly I managed to do this, but now I have a general understanding
problem. Let's say there are 100 comments there and I want to have reply
possiblity for each of them. Do I have to integrate the same code
underneath each one? I would rather like to have a box in that is used
for everyone of them. I believe this is somehow done with divs, but I do
not know how.
Here is my code:
<html>
<head>
<script src="/app_global/jquery-1.2.1.pack.js"
type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
$('#slickbox').hide();
$('a#reply').click(function() {
$('#slickbox').toggle('slow');
return false;
});
});
</script>
</head>
<body>
<a href="#" id="reply">Reply</a>
<div id="slickbox"><p>Space for reply box</div>
<p>
next comment
</body>
</html>
I would like to place a complex reply form into the id=slickbox, but
here is where the problems starts. If I do this for all 100 comments the
code will be way to much to load. Even if it is easy to do with PHP.
There must be a smarter way to achieve this.
Thank you for any help on this. I am pretty much stuck here.
Best regards,
Merlin
attached mail follows:
Hi,
Consider the following case
mysql> select *from names;
+----+---------+------------+
| id | name | phone |
+----+---------+------------+
| 1 | sanju | 9845650000 |
| 2 | sanjeev | 9972230000 |
| 3 | puttu | 9900580000 |
| 4 | raju | 9448110000 |
+----+---------+------------+
Now I want to display the row whose name is puttu (id=3) first and then want
to display other rows in order (order by name) as follows
+----+---------+------------+
| id | name | phone |
+----+---------+------------+
| 3 | puttu | 9900580000 |
| 4 | raju | 9448110000 |
| 2 | sanjeev | 9972230000 |
| 1 | sanju | 9845650000 |
+----+---------+------------+
Can somebody tell me is it possible. If its possible then please help me to
solve this problem.
Actually I am fetching all the rows from this table to my php page and there
if I choose some name then that should appear at top and rest should be
below in name order.
Warm Regards,
Sanjeev
http://www.sanchanworld.com/
http://webdirectory.sanchanworld.com - Submit your website URL
http://webhosting.sanchanworld.com - Choose your best web hosting plan
attached mail follows:
Sanjeev N wrote:
> Hi,
>
>
>
> Consider the following case
>
>
>
> mysql> select *from names;
>
> +----+---------+------------+
>
> | id | name | phone |
>
> +----+---------+------------+
>
> | 1 | sanju | 9845650000 |
>
> | 2 | sanjeev | 9972230000 |
>
> | 3 | puttu | 9900580000 |
>
> | 4 | raju | 9448110000 |
>
> +----+---------+------------+
>
>
>
> Now I want to display the row whose name is puttu (id=3) first and then want
> to display other rows in order (order by name) as follows
>
> +----+---------+------------+
>
> | id | name | phone |
>
> +----+---------+------------+
>
> | 3 | puttu | 9900580000 |
>
> | 4 | raju | 9448110000 |
>
> | 2 | sanjeev | 9972230000 |
>
> | 1 | sanju | 9845650000 |
>
> +----+---------+------------+
>
>
>
> Can somebody tell me is it possible. If its possible then please help me to
> solve this problem.
>
> Actually I am fetching all the rows from this table to my php page and there
> if I choose some name then that should appear at top and rest should be
> below in name order.
SELECT * from names ORDER by name;
Stephen
attached mail follows:
This should work:
ORDER BY CASE WHEN id = 3 THEN 0 ELSE 1 END, name
Andrew
attached mail follows:
pscott wrote:
>
>
> On Thu, 2007-10-25 at 02:25 -0700, DCVer wrote:
>> is this a good idea to use Ant with PHP or is there some similar tool to
>> Ant, that works fine with PHP? Thanks in advance.
>
> What you really want to look at is Phing, not Ant. It is very similar
> and I use it extensively for my project(s).
>
> --Paul
>
> Thanks very much. Do you know how to run the SQL script using Phing (my
> script creates SQL databases in MySQL)? I would be graceful for hint.
>
>
> All Email originating from UWC is covered by disclaimer
> http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--
View this message in context: http://www.nabble.com/Ant-in-php-tf4689539.html#a13413379
Sent from the PHP - General mailing list archive at Nabble.com.
attached mail follows:
Hi. Feel free to tell me this is a "duh" question. I don't know which PHP
executable (php.exe, php-cgi.exe, php-win.exe) is being run - how can I
tell?
I am on a Win2k3 server running PHP5 (manual install) and IIS6. I've pointed
to the php5isapi.dll in IIS. I'm assuming b/c I do this that I am using the
php.exe. Thoughts? I've searched the PHP manual, but have had no luck.
Thanks in advance,
~Philip
attached mail follows:
Philip Thompson wrote:
> Hi. Feel free to tell me this is a "duh" question. I don't know which PHP
> executable (php.exe, php-cgi.exe, php-win.exe) is being run - how can I
> tell?
>
> I am on a Win2k3 server running PHP5 (manual install) and IIS6. I've pointed
> to the php5isapi.dll in IIS. I'm assuming b/c I do this that I am using the
> php.exe. Thoughts? I've searched the PHP manual, but have had no luck.
>
> Thanks in advance,
> ~Philip
>
Well, if you use the isapi then you're not using ANY of the ones you
listed, you're using php5isapi.dll.
The others are for various uses; the php-cgi.exe is meant to be used if
you have php support via CGI instead of via the isapi (like you are).
php.exe is a simple CLI, and php-win.exe is also a CLI but does not give
any output, thus not showing any DOS windows (which php.exe DOES).
http://www.php.net/features.commandline should give you more info
- Tul
attached mail follows:
Philip Thompson wrote:
> Hi. Feel free to tell me this is a "duh" question. I don't know which PHP
> executable (php.exe, php-cgi.exe, php-win.exe) is being run - how can I
> tell?
>
> I am on a Win2k3 server running PHP5 (manual install) and IIS6. I've pointed
> to the php5isapi.dll in IIS. I'm assuming b/c I do this that I am using the
> php.exe. Thoughts? I've searched the PHP manual, but have had no luck.
You're not running any exe file. IIS uses php5isapi.dll instead of an
exe file - they essentially do the same job but the dll is designed to
be loaded into another application.
-Stut
--
http://stut.net/
attached mail follows:
Diana wrote:
> Using windows XP, when I try to send mail using 4 parameters, I get this :
>
> Warning: mail() [function.mail]: SMTP server response: 550 5.7.1 Unable to
> relay for dcastillo
tsanalytics.com in C:\Inetpub\wwwroot\intranet\test.php
> on line 9
The SMTP server you are using is not configured to allow the machine
you're running PHP on to send mail. This is not a PHP problem - speak to
your mail server administrator.
-Stut
--
http://stut.net/
attached mail follows:
Instruct ICC wrote:
>
>
>> Date: Thu, 25 Oct 2007 09:43:14 +0800
>> From: ronald
elmit.com
>> To: php-general
lists.php.net
>> Subject: [PHP] system command
>>
>> I tried:
>>
>> $a=$_SERVER["REMOTE_ADDR"];
>> echo "<p>REMOTE_ADDR=$a<br>";
>> if($a="192.168.250.108") {
>> $a="61.64.101.101";
>> }
>>
>>
>> $aa=system('lynx -dump http://api.hostip.info/country.php?ip=$a',$location);
>> echo "<p>a=$a<br>aa=$aa<br>location=$location<br>";
>>
>> $aa=system('lynx -dump
>> http://api.hostip.info/country.php?ip=61.64.101.101',$location);
>> echo "<p>a=$a<br>aa=$aa<br>location=$location<br>";
>>
>>
>> I get:
>>
>> REMOTE_ADDR=192.168.250.108
>> XX
>>
>> a=61.64.101.101
>> aa=XX
>> location=0
>> TW
>>
>> a=61.64.101.101
>> aa=TW
>> location=0
>>
>>
>> as you can see, if I put the IP address in, I get the right answer (TW).
>>
>> What am I doing wrong?
>>
>> bye
>>
>> Ronald
>>
> Use double quotes to get the value of $a or else you get the literal string "$a".
>
> $aa=system("lynx -dump http://api.hostip.info/country.php?ip=$a",$location);
> or
> $aa=system('lynx -dump http://api.hostip.info/country.php?ip='.$a,$location);
>
>
Thanks! 1st solution did not work for me, but the second one did.
I still have a problem with it. It prints the info to the page. Can I
suppress this somehow?
bye
Ronald
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]