473,395 Members | 1,649 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

How can a php class read from a properties file?

I have a class that calls some web services. I did not want the url of
the web services to be hardcoded in the class. What is the best way to
go about doing this?
Jan 11 '08 #1
4 18554
Anthony Smith wrote:
I have a class that calls some web services. I did not want the url of
the web services to be hardcoded in the class. What is the best way to
go about doing this?
Set the url as a property and initialize it via the constructor or a set
function (or give the ability to do both).

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Jan 11 '08 #2
property
Jan 13 '08 #3
Rob
On Jan 11, 9:24*pm, Anthony Smith <mrsmi...@hotmail.comwrote:
I have a class that calls some web services. I did not want the url of
the web services to be hardcoded in the class. What is the best way to
go about doing this?
Anthony, you could do this in a similar way to .Net, by using an
application configuration file.

The file can then be read in using parse_ini_file() -
http://uk.php.net/manual/en/function.parse-ini-file.php

The same thing is sometimes done by storing configuration details in a
database, and reading those in at runtime.

Rob.
Jan 15 '08 #4
On Jan 15, 7:45 am, Rob <ratkin...@tbs-ltd.co.ukwrote:
On Jan 11, 9:24 pm,AnthonySmith<mrsmi...@hotmail.comwrote:
I have a class that calls some web services. I did not want the url of
the web services to be hardcoded in the class. What is the best way to
go about doing this?

Anthony, you could do this in a similar way to .Net, by using an
application configuration file.

The file can then be read in using parse_ini_file() -http://uk.php.net/manual/en/function.parse-ini-file.php

The same thing is sometimes done by storing configuration details in a
database, and reading those in at runtime.

Rob.
Thanks Rob. Exactly what I was looking for.
Jan 15 '08 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Paul | last post by:
Hello, I've been reading up on security in Java Applets and whilst I understand the concept, I can't successfully get my applet to read a file on my local machine. I discovered from...
2
by: Sachin | last post by:
Hi All, Is there any class which provides support file properties file similare to java Properties? Basically I looking for reading/writing properties file in C# of format attrName=Value...
2
by: Jon Spivey | last post by:
Hi, probably missing something obvious here. I have a user control hot10.ascx which just contains a repeater, a code behind file hot10.ascx.vb which fills the repeater from a datareader and a...
8
by: reviswami78 | last post by:
Hi : I wanted to know if the following is possible in C# ( .NET Framework 1.x): I want to add an attribute to a class in a separate file i.e. in a file other than which the class itself is...
5
by: rjl444 | last post by:
My app has a lot of properties, instead of placing the values in webconfig file (because I have tons), I would like to place these in it's own file. What is the best way of using an independant...
4
by: df | last post by:
We all know we can keep value of server control between post-back,but how can do this with web form class member properties?For example,I want to decare a class member property as array,to store...
2
by: =?Utf-8?B?YW5rMmdv?= | last post by:
Thanks in advance for reading this. Let's say I have a file (file01) with this data in ASCII (ignore line col): line01 123abc line02 Header01 Starts blah var line03 detail01 000001...
5
by: sajithamol | last post by:
I'm trying to read a properties file using BufferedInputStream and getResourceAsStream(),but getting "java.io.IOException: Stream closed' exception. My properties file is not set in the classpath,...
7
by: =?Utf-8?B?VGFtbXkgTmVqYWRpYW4=?= | last post by:
Hi, I am using visual studio C# window and I have an xml file which I need to read that file using Object Oriented program. What codes I should use in my class to load and read that xml file....
4
by: Mr Gray | last post by:
Hi Guys, My requirement is to scan an FTP directory for the presence of 4 files and if a specific file exists I can begin to GET those files, read the contents and save the contents into an SQL...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.