Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #5855 > unrolled thread

reading a newline from a properties file

Started bytaltene@gmail.com
First post2012-05-08 07:21 -0700
Last post2012-05-09 05:47 -0700
Articles 15 — 7 participants

Back to article view | Back to comp.lang.php


Contents

  reading a newline from a properties file taltene@gmail.com - 2012-05-08 07:21 -0700
    Re: reading a newline from a properties file The Natural Philosopher <tnp@invalid.invalid> - 2012-05-08 15:42 +0100
    Re: reading a newline from a properties file "Álvaro G. Vicario" <alvaro.NOSPAMTHANX@demogracia.com.invalid> - 2012-05-08 16:53 +0200
    Re: reading a newline from a properties file "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2012-05-08 18:52 +0200
    Re: reading a newline from a properties file Denis McMahon <denismfmcmahon@gmail.com> - 2012-05-08 17:33 +0000
    Re: reading a newline from a properties file taltene@gmail.com - 2012-05-08 22:43 -0700
      Re: reading a newline from a properties file "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2012-05-09 09:50 +0200
      Re: reading a newline from a properties file "Álvaro G. Vicario" <alvaro.NOSPAMTHANX@demogracia.com.invalid> - 2012-05-09 10:20 +0200
        Re: reading a newline from a properties file "Álvaro G. Vicario" <alvaro.NOSPAMTHANX@demogracia.com.invalid> - 2012-05-09 10:37 +0200
          Re: reading a newline from a properties file taltene@gmail.com - 2012-05-09 04:21 -0700
            Re: reading a newline from a properties file Jerry Stuckle <jstucklex@attglobal.net> - 2012-05-09 10:33 -0400
              Re: reading a newline from a properties file taltene@gmail.com - 2012-05-09 22:56 -0700
                Re: reading a newline from a properties file Jerry Stuckle <jstucklex@attglobal.net> - 2012-05-15 07:49 -0400
            Re: reading a newline from a properties file Captain Paralytic <paul_lautman@yahoo.com> - 2012-05-09 05:26 -0700
              Re: reading a newline from a properties file taltene@gmail.com - 2012-05-09 05:47 -0700

#5855 — reading a newline from a properties file

Fromtaltene@gmail.com
Date2012-05-08 07:21 -0700
Subjectreading a newline from a properties file
Message-ID<20447277.1852.1336486906498.JavaMail.geo-discussion-forums@ynff7>
Hi all.

 I need to write an HTTP response string in a properties file and read from a PHP file.

 For example:

 My_Response=HTTP/1.1 200 OK

 Server: gSOAP/2.7\

 Content-Type: text/xml; charset\=utf-8

 (etc.)

 Everything I tried failed: adding \n and \r\n inside the response line, writing the lines in seperate lines.

 When using one line with the formatting chars I always see those characters and not a real carrige return as I want.

 When I write the response in multiple lines, I only get the first line in response.

 I also added \ at the end of each line.

Can you help please?

Thanks!

[toc] | [next] | [standalone]


#5856

FromThe Natural Philosopher <tnp@invalid.invalid>
Date2012-05-08 15:42 +0100
Message-ID<jobbcm$a1f$1@news.albasani.net>
In reply to#5855
taltene@gmail.com wrote:
> Hi all.
> 
>  I need to write an HTTP response string in a properties file and read from a PHP file.
> 
>  For example:
> 
>  My_Response=HTTP/1.1 200 OK
> 
>  Server: gSOAP/2.7\
> 
>  Content-Type: text/xml; charset\=utf-8
> 
>  (etc.)
> 
>  Everything I tried failed: adding \n and \r\n inside the response line, writing the lines in seperate lines.
> 
>  When using one line with the formatting chars I always see those characters and not a real carrige return as I want.
> 
>  When I write the response in multiple lines, I only get the first line in response.
> 
>  I also added \ at the end of each line.
> 
> Can you help please?
> 
> Thanks!

I am not clear as to exactly what you want, but using printf or sprintf 
or fprintf and using douible quote string delimiters

i.e. printf("Googleblat: fred\nDoodlebug: Hit me!\n"); works for me.


IIRC the double quotes are significant.



-- 
To people who know nothing, anything is possible.
To people who know too much, it is a sad fact
that they know how little is really possible -
and how hard it is to achieve it.

[toc] | [prev] | [next] | [standalone]


#5857

From"Álvaro G. Vicario" <alvaro.NOSPAMTHANX@demogracia.com.invalid>
Date2012-05-08 16:53 +0200
Message-ID<jobc1q$h2c$1@dont-email.me>
In reply to#5855
El 08/05/2012 16:21, taltene@gmail.com escribió/wrote:
>   I need to write an HTTP response string in a properties file and read from a PHP file.
>
>   For example:
>
>   My_Response=HTTP/1.1 200 OK
>
>   Server: gSOAP/2.7\
>
>   Content-Type: text/xml; charset\=utf-8
>
>   (etc.)
>
>   Everything I tried failed: adding \n and \r\n inside the response line, writing the lines in seperate lines.
>
>   When using one line with the formatting chars I always see those characters and not a real carrige return as I want.
>
>   When I write the response in multiple lines, I only get the first line in response.
>
>   I also added \ at the end of each line.

I know nothing about gSOAP so I guess that's the reason why I can't 
understand this question at all. But I've seen too many people printing 
plain text into an HTML document and then wondering where the line feeds 
went. Just make sure it isn't your case.


-- 
-- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web: http://borrame.com
-- Mi web de humor satinado: http://www.demogracia.com
--

[toc] | [prev] | [next] | [standalone]


#5858

From"M. Strobel" <sorry_no_mail_here@nowhere.dee>
Date2012-05-08 18:52 +0200
Message-ID<a0t1aqF7a2U1@mid.uni-berlin.de>
In reply to#5855
Am 08.05.2012 16:21, schrieb taltene@gmail.com:
> Hi all.
> 
>  I need to write an HTTP response string in a properties file and read from a PHP file.
> 
>  For example:
> 
>  My_Response=HTTP/1.1 200 OK
> 
>  Server: gSOAP/2.7\
> 
>  Content-Type: text/xml; charset\=utf-8
> 
>  (etc.)
> 
>  Everything I tried failed: adding \n and \r\n inside the response line, writing the lines in seperate lines.
> 
>  When using one line with the formatting chars I always see those characters and not a real carrige return as I want.
> 
>  When I write the response in multiple lines, I only get the first line in response.
> 
>  I also added \ at the end of each line.
> 
> Can you help please?

Shall we guess? Show the relevant part of your code.

/Str.

[toc] | [prev] | [next] | [standalone]


#5859

FromDenis McMahon <denismfmcmahon@gmail.com>
Date2012-05-08 17:33 +0000
Message-ID<4fa958fe$0$2981$a8266bb1@newsreader.readnews.com>
In reply to#5855
On Tue, 08 May 2012 07:21:46 -0700, taltene wrote:

>  I need to write an HTTP response string in a properties file

Ok, you lost me at "properties file". What is a properties file? I can 
find no obvious results on the php website searching for "properties 
file".

Rgds

Denis McMahon

[toc] | [prev] | [next] | [standalone]


#5865

Fromtaltene@gmail.com
Date2012-05-08 22:43 -0700
Message-ID<12113687.988.1336542193956.JavaMail.geo-discussion-forums@vbpz13>
In reply to#5855
בתאריך יום שלישי, 8 במאי 2012 17:21:46 UTC+3, מאת tal...@gmail.com:
> Hi all.
> 
>  I need to write an HTTP response string in a properties file and read from a PHP file.
> 
>  For example:
> 
>  My_Response=HTTP/1.1 200 OK
> 
>  Server: gSOAP/2.7\
> 
>  Content-Type: text/xml; charset\=utf-8
> 
>  (etc.)
> 
>  Everything I tried failed: adding \n and \r\n inside the response line, writing the lines in seperate lines.
> 
>  When using one line with the formatting chars I always see those characters and not a real carrige return as I want.
> 
>  When I write the response in multiple lines, I only get the first line in response.
> 
>  I also added \ at the end of each line.
> 
> Can you help please?
> 
> Thanks!

Thanks you all guys for your replies.
The fact that the text is an HTTP response is of course not important. The issue is a text that should be in multiple lines. 
I added the real text because I though maybe there is a character that makes the problem.

To those who asked: a proerties file is a file with key=value pairs. Thats all.

So in my case the key is My_Response and the value is the http response string. Again - the meaning is irelevant.

This is the function I use to try and read the value:

----------------------------------------
Function ReadValueByKey ($PropFile, $PropKey) {

	print("ReadValueByKey\n");

	$Prop_Key = strtolower($PropKey);
	$Prop_File = file($PropFile);

	unset($Prop_Value);

	for($Counter = 0; $Counter < sizeof($Prop_File); $Counter++) {

		$Prop_Temp = trim($Prop_File[$Counter]); // Trim Prop line. Save the original var value to return it as result
		$Prop_Tmp = strtolower($Prop_Temp);
		//print("Prop_Tmp=".$Prop_Tmp."\n");			
		if (substr_count($Prop_Tmp, $Prop_Key . "=") > 0) {
			 $Prop_Value = substr($Prop_Temp, strlen($Prop_Key . "="));
			 return $Prop_Value;
		}
	} // end for

	if ( !$Prop_Key ) {
		return "ERROR .: Key: or Variable: <b>".strtoupper($Prop_Key)."</b>, does not exist in <b>".strtoupper($PropFile)."</b> file !"; // Key or Variable NOT FOUND in Prop file
	}
}
--------------------------------------

Thank you all!

[toc] | [prev] | [next] | [standalone]


#5866

From"M. Strobel" <sorry_no_mail_here@nowhere.dee>
Date2012-05-09 09:50 +0200
Message-ID<a0uluaFdjeU1@mid.uni-berlin.de>
In reply to#5865
Am 09.05.2012 07:43, schrieb taltene@gmail.com:
> בתאריך יום שלישי, 8 במאי 2012 17:21:46 UTC+3, מאת tal...@gmail.com:
>> Hi all.
>>
>>  I need to write an HTTP response string in a properties file and read from a PHP file.
>>
>>  For example:
>>
>>  My_Response=HTTP/1.1 200 OK
>>
>>  Server: gSOAP/2.7\
>>
>>  Content-Type: text/xml; charset\=utf-8
>>
>>  (etc.)
>>
>>  Everything I tried failed: adding \n and \r\n inside the response line, writing the lines in seperate lines.
>>
>>  When using one line with the formatting chars I always see those characters and not a real carrige return as I want.
>>
>>  When I write the response in multiple lines, I only get the first line in response.
>>
>>  I also added \ at the end of each line.
>>
>> Can you help please?
>>
>> Thanks!
> 
> Thanks you all guys for your replies.
> The fact that the text is an HTTP response is of course not important. The issue is a text that should be in multiple lines. 
> I added the real text because I though maybe there is a character that makes the problem.
> 
> To those who asked: a proerties file is a file with key=value pairs. Thats all.
> 
> So in my case the key is My_Response and the value is the http response string. Again - the meaning is irelevant.
> 
> This is the function I use to try and read the value:
> 
> ----------------------------------------
> Function ReadValueByKey ($PropFile, $PropKey) {
> 
> 	print("ReadValueByKey\n");
> 
> 	$Prop_Key = strtolower($PropKey);
> 	$Prop_File = file($PropFile);
> 
> 	unset($Prop_Value);
> 
> 	for($Counter = 0; $Counter < sizeof($Prop_File); $Counter++) {
> 
> 		$Prop_Temp = trim($Prop_File[$Counter]); // Trim Prop line. Save the original var value to return it as result
> 		$Prop_Tmp = strtolower($Prop_Temp);
> 		//print("Prop_Tmp=".$Prop_Tmp."\n");			
> 		if (substr_count($Prop_Tmp, $Prop_Key . "=") > 0) {
> 			 $Prop_Value = substr($Prop_Temp, strlen($Prop_Key . "="));
> 			 return $Prop_Value;
> 		}
> 	} // end for
> 
> 	if ( !$Prop_Key ) {
> 		return "ERROR .: Key: or Variable: <b>".strtoupper($Prop_Key)."</b>, does not exist in <b>".strtoupper($PropFile)."</b> file !"; // Key or Variable NOT FOUND in Prop file
> 	}
> }
> --------------------------------------
> 
Just a first impression:

this is old fashioned C in PHP, tampering with string lengths and substrings, error
prone. A regular expression would be cleaner.

/Str.

[toc] | [prev] | [next] | [standalone]


#5870

From"Álvaro G. Vicario" <alvaro.NOSPAMTHANX@demogracia.com.invalid>
Date2012-05-09 10:20 +0200
Message-ID<jod9bh$51c$1@dont-email.me>
In reply to#5865
El 09/05/2012 7:43, taltene@gmail.com escribió/wrote:
> בתאריך יום שלישי, 8 במאי 2012 17:21:46 UTC+3, מאת tal...@gmail.com:
> This is the function I use to try and read the value:

Believe it or not, real code is always better than a vague description 
of it :)

> 	$Prop_File = file($PropFile);
[...]
> 		$Prop_Temp = trim($Prop_File[$Counter]); // Trim Prop line. Save the original var value to return it as result

 From the manual:

«Returns the file in an array. Each element of the array corresponds to 
a line in the file, with the newline still attached. Upon failure, 
file() returns FALSE.

Note: Each line in the resulting array will include the line ending, 
unless FILE_IGNORE_NEW_LINES is used, so you still need to use rtrim() 
if you do not want the line ending present.»

http://php.net/file

So you instruct PHP to read lines with trailing line feed and then 
remove it at a later stage.

The obvious questions now are:

1. Why are line feeds important if you strip them anyway?
2. What do you want to accomplish and how does your code fail to do so?


-- 
-- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web: http://borrame.com
-- Mi web de humor satinado: http://www.demogracia.com
--

[toc] | [prev] | [next] | [standalone]


#5871

From"Álvaro G. Vicario" <alvaro.NOSPAMTHANX@demogracia.com.invalid>
Date2012-05-09 10:37 +0200
Message-ID<jodabf$9in$1@dont-email.me>
In reply to#5870
El 09/05/2012 10:20, "Álvaro G. Vicario" escribió/wrote:
> El 09/05/2012 7:43, taltene@gmail.com escribió/wrote:
>> בתאריך יום שלישי, 8 במאי 2012 17:21:46 UTC+3, מאת tal...@gmail.com:
>> This is the function I use to try and read the value:

BTW, if I had to read such file I'd do this:

function read_value_by_key ($prop_file, $prop_key){
	$props = parse_ini_file($prop_file, FALSE, INI_SCANNER_RAW);
	return array_key_exists($prop_key, $props) ? trim($props[$prop_key]) : 
FALSE;
}



-- 
-- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web: http://borrame.com
-- Mi web de humor satinado: http://www.demogracia.com
--

[toc] | [prev] | [next] | [standalone]


#5873

Fromtaltene@gmail.com
Date2012-05-09 04:21 -0700
Message-ID<32272.1918.1336562506765.JavaMail.geo-discussion-forums@vbq19>
In reply to#5871
Thanks!
I tried to use your code.
But it still no good for me.
This is the input:

------------------------------------------------------------

 _resp_chargingIdx=<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:al="http://www.alcatel-lucent.com/soap_cm" xmlns:gd="http://www.3gpp.org/ftp/Specs/archive/32_series/32317/schema/32317-700/GenericIRPData" xmlns:bs="http://www.3gpp.org/ftp/Specs/archive/32_series/32607/schema/32607-700/BasicCMIRPSystem" xmlns:bd="http://www.3gpp.org/ftp/Specs/archive/32_series/32607/schema/32607-700/BasicCMIRPData">
.<SOAP-ENV:Body>
..<bd:createMOResponse>
...<mO>
....<moiLocation>imsServiceProfileId=1,suMSubscriptionProfileId=1,suMSubscriberProfileId=+14716000005_at,subscriptionFunctionId=1,managedElementId=HSS1</moiLocation>
...</mO>
..</bd:createMOResponse>
.</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

------------------------------------------------------------
and this is what print_r($pros) retruns:
------------------------------------------------------------

 [_resp_chargingIdx] => <?xml version=\"1.0\" encoding=\"UTF-8\"?>
    [<SOAP-ENV:Envelope xmlns:SOAP-ENV] => \"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:SOAP-ENC=\"http://schemas.xmlsoap.org/soap/encoding/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:al=\"http://www.alcatel-lucent.com/soap_cm\" xmlns:gd=\"http://www.3gpp.org/ftp/Specs/archive/32_series/32317/schema/32317-700/GenericIRPData\" xmlns:bs=\"http://www.3gpp.org/ftp/Specs/archive/32_series/32607/schema/32607-700/BasicCMIRPSystem\" xmlns:bd=\"http://www.3gpp.org/ftp/Specs/archive/32_series/32607/schema/32607-700/BasicCMIRPData\">
    [....<moiLocation>imsServiceProfileId] => 1,suMSubscriptionProfileId=1,suMSubscriberProfileId=+14716000005_at,subscriptionFunctionId=1,managedElementId=HSS1</moiLocation>
-------------------------------------

and of course the only key is _resp_chargingIdx...

any help will be appreciated.
Thanks!!!

[toc] | [prev] | [next] | [standalone]


#5879

FromJerry Stuckle <jstucklex@attglobal.net>
Date2012-05-09 10:33 -0400
Message-ID<jodv8e$u5u$1@dont-email.me>
In reply to#5873
On 5/9/2012 7:21 AM, taltene@gmail.com wrote:
> Thanks!
> I tried to use your code.
> But it still no good for me.
> This is the input:
>
> ------------------------------------------------------------
>
>   _resp_chargingIdx=<?xml version="1.0" encoding="UTF-8"?>
> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:al="http://www.alcatel-lucent.com/soap_cm" xmlns:gd="http://www.3gpp.org/ftp/Specs/archive/32_series/32317/schema/32317-700/GenericIRPData" xmlns:bs="http://www.3gpp.org/ftp/Specs/archive/32_series/32607/schema/32607-700/BasicCMIRPSystem" xmlns:bd="http://www.3gpp.org/ftp/Specs/archive/32_series/32607/schema/32607-700/BasicCMIRPData">
> .<SOAP-ENV:Body>
> ..<bd:createMOResponse>
> ...<mO>
> ....<moiLocation>imsServiceProfileId=1,suMSubscriptionProfileId=1,suMSubscriberProfileId=+14716000005_at,subscriptionFunctionId=1,managedElementId=HSS1</moiLocation>
> ...</mO>
> ..</bd:createMOResponse>
> .</SOAP-ENV:Body>
> </SOAP-ENV:Envelope>
>
> ------------------------------------------------------------
> and this is what print_r($pros) retruns:
> ------------------------------------------------------------
>
>   [_resp_chargingIdx] =>  <?xml version=\"1.0\" encoding=\"UTF-8\"?>
>      [<SOAP-ENV:Envelope xmlns:SOAP-ENV] =>  \"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:SOAP-ENC=\"http://schemas.xmlsoap.org/soap/encoding/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:al=\"http://www.alcatel-lucent.com/soap_cm\" xmlns:gd=\"http://www.3gpp.org/ftp/Specs/archive/32_series/32317/schema/32317-700/GenericIRPData\" xmlns:bs=\"http://www.3gpp.org/ftp/Specs/archive/32_series/32607/schema/32607-700/BasicCMIRPSystem\" xmlns:bd=\"http://www.3gpp.org/ftp/Specs/archive/32_series/32607/schema/32607-700/BasicCMIRPData\">
>      [....<moiLocation>imsServiceProfileId] =>  1,suMSubscriptionProfileId=1,suMSubscriberProfileId=+14716000005_at,subscriptionFunctionId=1,managedElementId=HSS1</moiLocation>
> -------------------------------------
>
> and of course the only key is _resp_chargingIdx...
>
> any help will be appreciated.
> Thanks!!!
>

There are a number of problems with your code.  For instance, if the key 
you are looking for is "abc=", it will also match on "xyzabc=".  Also it 
could match a value such as "The expression abc=def is bad".

I'm still not sure what you're looking for.  I tested your function with 
the input you listed:

print_r(ReadValueByKey('properties.txt', '_resp_chargingIdx'));

The results:

ReadValueByKey
<?xml version="1.0" encoding="UTF-8"?>

which is what I would expect from the given code.

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

[toc] | [prev] | [next] | [standalone]


#6059

Fromtaltene@gmail.com
Date2012-05-09 22:56 -0700
Message-ID<26575563.517.1336629363359.JavaMail.geo-discussion-forums@vbxz8>
In reply to#5879
בתאריך יום רביעי, 9 במאי 2012 17:33:43 UTC+3, מאת Jerry Stuckle:
> On 5/9/2012 7:21 AM, taltene wrote:
> > Thanks!
> > I tried to use your code.
> > But it still no good for me.
> > This is the input:
> >
> > ------------------------------------------------------------
> >
> >   _resp_chargingIdx=<?xml version="1.0" encoding="UTF-8"?>
> > <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:al="http://www.alcatel-lucent.com/soap_cm" xmlns:gd="http://www.3gpp.org/ftp/Specs/archive/32_series/32317/schema/32317-700/GenericIRPData" xmlns:bs="http://www.3gpp.org/ftp/Specs/archive/32_series/32607/schema/32607-700/BasicCMIRPSystem" xmlns:bd="http://www.3gpp.org/ftp/Specs/archive/32_series/32607/schema/32607-700/BasicCMIRPData">
> > .<SOAP-ENV:Body>
> > ..<bd:createMOResponse>
> > ...<mO>
> > ....<moiLocation>imsServiceProfileId=1,suMSubscriptionProfileId=1,suMSubscriberProfileId=+14716000005_at,subscriptionFunctionId=1,managedElementId=HSS1</moiLocation>
> > ...</mO>
> > ..</bd:createMOResponse>
> > .</SOAP-ENV:Body>
> > </SOAP-ENV:Envelope>
> >
> > ------------------------------------------------------------
> > and this is what print_r($pros) retruns:
> > ------------------------------------------------------------
> >
> >   [_resp_chargingIdx] =>  <?xml version=\"1.0\" encoding=\"UTF-8\"?>
> >      [<SOAP-ENV:Envelope xmlns:SOAP-ENV] =>  \"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:SOAP-ENC=\"http://schemas.xmlsoap.org/soap/encoding/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:al=\"http://www.alcatel-lucent.com/soap_cm\" xmlns:gd=\"http://www.3gpp.org/ftp/Specs/archive/32_series/32317/schema/32317-700/GenericIRPData\" xmlns:bs=\"http://www.3gpp.org/ftp/Specs/archive/32_series/32607/schema/32607-700/BasicCMIRPSystem\" xmlns:bd=\"http://www.3gpp.org/ftp/Specs/archive/32_series/32607/schema/32607-700/BasicCMIRPData\">
> >      [....<moiLocation>imsServiceProfileId] =>  1,suMSubscriptionProfileId=1,suMSubscriberProfileId=+14716000005_at,subscriptionFunctionId=1,managedElementId=HSS1</moiLocation>
> > -------------------------------------
> >
> > and of course the only key is _resp_chargingIdx...
> >
> > any help will be appreciated.
> > Thanks!!!
> >
> 
> There are a number of problems with your code.  For instance, if the key 
> you are looking for is "abc=", it will also match on "xyzabc=".  Also it 
> could match a value such as "The expression abc=def is bad".
> 
> I'm still not sure what you're looking for.  I tested your function with 
> the input you listed:
> 
> print_r(ReadValueByKey('properties.txt', '_resp_chargingIdx'));
> 
> The results:
> 
> ReadValueByKey
> <?xml version="1.0" encoding="UTF-8"?>
> 
> which is what I would expect from the given code.
> 
> -- 
> ==================
> Remove the "x" from my email address
> Jerry Stuckle
> JDS Computer Training Corp.
> jstucklex@attglobal.net
> ==================

Tannk you Jerry.
The problem is that the property value is not only 
  <?xml version="1.0" encoding="UTF-8"?> 
but it is a multiple line value, and this is what I need to get in return for this function.

[toc] | [prev] | [next] | [standalone]


#6068

FromJerry Stuckle <jstucklex@attglobal.net>
Date2012-05-15 07:49 -0400
Message-ID<jotfru$efj$1@dont-email.me>
In reply to#6059
On 5/10/2012 1:56 AM, taltene@gmail.com wrote:
> בתאריך יום רביעי, 9 במאי 2012 17:33:43 UTC+3, מאת Jerry Stuckle:
>> On 5/9/2012 7:21 AM, taltene wrote:
>>> Thanks!
>>> I tried to use your code.
>>> But it still no good for me.
>>> This is the input:
>>>
>>> ------------------------------------------------------------
>>>
>>>    _resp_chargingIdx=<?xml version="1.0" encoding="UTF-8"?>
>>> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:al="http://www.alcatel-lucent.com/soap_cm" xmlns:gd="http://www.3gpp.org/ftp/Specs/archive/32_series/32317/schema/32317-700/GenericIRPData" xmlns:bs="http://www.3gpp.org/ftp/Specs/archive/32_series/32607/schema/32607-700/BasicCMIRPSystem" xmlns:bd="http://www.3gpp.org/ftp/Specs/archive/32_series/32607/schema/32607-700/BasicCMIRPData">
>>> .<SOAP-ENV:Body>
>>> ..<bd:createMOResponse>
>>> ...<mO>
>>> ....<moiLocation>imsServiceProfileId=1,suMSubscriptionProfileId=1,suMSubscriberProfileId=+14716000005_at,subscriptionFunctionId=1,managedElementId=HSS1</moiLocation>
>>> ...</mO>
>>> ..</bd:createMOResponse>
>>> .</SOAP-ENV:Body>
>>> </SOAP-ENV:Envelope>
>>>
>>> ------------------------------------------------------------
>>> and this is what print_r($pros) retruns:
>>> ------------------------------------------------------------
>>>
>>>    [_resp_chargingIdx] =>   <?xml version=\"1.0\" encoding=\"UTF-8\"?>
>>>       [<SOAP-ENV:Envelope xmlns:SOAP-ENV] =>   \"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:SOAP-ENC=\"http://schemas.xmlsoap.org/soap/encoding/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:al=\"http://www.alcatel-lucent.com/soap_cm\" xmlns:gd=\"http://www.3gpp.org/ftp/Specs/archive/32_series/32317/schema/32317-700/GenericIRPData\" xmlns:bs=\"http://www.3gpp.org/ftp/Specs/archive/32_series/32607/schema/32607-700/BasicCMIRPSystem\" xmlns:bd=\"http://www.3gpp.org/ftp/Specs/archive/32_series/32607/schema/32607-700/BasicCMIRPData\">
>>>       [....<moiLocation>imsServiceProfileId] =>   1,suMSubscriptionProfileId=1,suMSubscriberProfileId=+14716000005_at,subscriptionFunctionId=1,managedElementId=HSS1</moiLocation>
>>> -------------------------------------
>>>
>>> and of course the only key is _resp_chargingIdx...
>>>
>>> any help will be appreciated.
>>> Thanks!!!
>>>
>>
>> There are a number of problems with your code.  For instance, if the key
>> you are looking for is "abc=", it will also match on "xyzabc=".  Also it
>> could match a value such as "The expression abc=def is bad".
>>
>> I'm still not sure what you're looking for.  I tested your function with
>> the input you listed:
>>
>> print_r(ReadValueByKey('properties.txt', '_resp_chargingIdx'));
>>
>> The results:
>>
>> ReadValueByKey
>> <?xml version="1.0" encoding="UTF-8"?>
>>
>> which is what I would expect from the given code.
>>
>
> Tannk you Jerry.
> The problem is that the property value is not only
>    <?xml version="1.0" encoding="UTF-8"?>
> but it is a multiple line value, and this is what I need to get in return for this function.

Sorry for the late reply; your response just showed up on my news server.

OK, my next question would be then, how is the system supposed to know 
where one property stops and the next one starts?  I know you only have 
one in this file, but what if you had two or three (or more)?

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

[toc] | [prev] | [next] | [standalone]


#6056

FromCaptain Paralytic <paul_lautman@yahoo.com>
Date2012-05-09 05:26 -0700
Message-ID<87116c48-3c50-40f7-b2c5-a8638a0a4067@gn8g2000vbb.googlegroups.com>
In reply to#5873
On May 9, 12:21 pm, talt...@gmail.com wrote:
> Thanks!
> I tried to use your code.
> But it still no good for me.
> This is the input:
>
> ------------------------------------------------------------
>
>  _resp_chargingIdx=<?xml version="1.0" encoding="UTF-8"?>
> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:al="http://www.alcatel-lucent.com/soap_cm" xmlns:gd="http://www.3gpp.org/ftp/Specs/archive/32_series/32317/schema/32317-70..." xmlns:bs="http://www.3gpp.org/ftp/Specs/archive/32_series/32607/schema/32607-70..." xmlns:bd="http://www.3gpp.org/ftp/Specs/archive/32_series/32607/schema/32607-70...">
> .<SOAP-ENV:Body>
> ..<bd:createMOResponse>
> ...<mO>
> ....<moiLocation>imsServiceProfileId=1,suMSubscriptionProfileId=1,suMSubscr iberProfileId=+14716000005_at,subscriptionFunctionId=1,managedElementId=HSS 1</moiLocation>
> ...</mO>
> ..</bd:createMOResponse>
> .</SOAP-ENV:Body>
> </SOAP-ENV:Envelope>
>
> ------------------------------------------------------------
> and this is what print_r($pros) retruns:
> ------------------------------------------------------------
>
>  [_resp_chargingIdx] => <?xml version=\"1.0\" encoding=\"UTF-8\"?>
>     [<SOAP-ENV:Envelope xmlns:SOAP-ENV] => \"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:SOAP-ENC=\"http://schemas.xmlsoap.org/soap/encoding/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:al=\"http://www.alcatel-lucent.com/soap_cm\" xmlns:gd=\"http://www.3gpp.org/ftp/Specs/archive/32_series/32317/schema/32317-70..." xmlns:bs=\"http://www.3gpp.org/ftp/Specs/archive/32_series/32607/schema/32607-70..." xmlns:bd=\"http://www.3gpp.org/ftp/Specs/archive/32_series/32607/schema/32607-70...">
>     [....<moiLocation>imsServiceProfileId] => 1,suMSubscriptionProfileId=1,suMSubscriberProfileId=+14716000005_at,subscri ptionFunctionId=1,managedElementId=HSS1</moiLocation>
> -------------------------------------
>
> and of course the only key is _resp_chargingIdx...
>
> any help will be appreciated.
> Thanks!!!

Where did $pros come from? Can you show us the code you use to get the
variable $pros?

[toc] | [prev] | [next] | [standalone]


#6057

Fromtaltene@gmail.com
Date2012-05-09 05:47 -0700
Message-ID<19387178.1854.1336567658358.JavaMail.geo-discussion-forums@ynja13>
In reply to#6056
בתאריך יום רביעי, 9 במאי 2012 15:26:25 UTC+3, מאת Captain Paralytic:
> On May 9, 12:21 pm, talt...@gmail.com wrote:
> > Thanks!
> > I tried to use your code.
> > But it still no good for me.
> > This is the input:
> >
> > ------------------------------------------------------------
> >
> >  _resp_chargingIdx=<?xml version="1.0" encoding="UTF-8"?>
> > <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:al="http://www.alcatel-lucent.com/soap_cm" xmlns:gd="http://www.3gpp.org/ftp/Specs/archive/32_series/32317/schema/32317-70..." xmlns:bs="http://www.3gpp.org/ftp/Specs/archive/32_series/32607/schema/32607-70..." xmlns:bd="http://www.3gpp.org/ftp/Specs/archive/32_series/32607/schema/32607-70...">
> > .<SOAP-ENV:Body>
> > ..<bd:createMOResponse>
> > ...<mO>
> > ....<moiLocation>imsServiceProfileId=1,suMSubscriptionProfileId=1,suMSubscr iberProfileId=+14716000005_at,subscriptionFunctionId=1,managedElementId=HSS 1</moiLocation>
> > ...</mO>
> > ..</bd:createMOResponse>
> > .</SOAP-ENV:Body>
> > </SOAP-ENV:Envelope>
> >
> > ------------------------------------------------------------
> > and this is what print_r($pros) retruns:
> > ------------------------------------------------------------
> >
> >  [_resp_chargingIdx] => <?xml version=\"1.0\" encoding=\"UTF-8\"?>
> >     [<SOAP-ENV:Envelope xmlns:SOAP-ENV] => \"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:SOAP-ENC=\"http://schemas.xmlsoap.org/soap/encoding/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:al=\"http://www.alcatel-lucent.com/soap_cm\" xmlns:gd=\"http://www.3gpp.org/ftp/Specs/archive/32_series/32317/schema/32317-70..." xmlns:bs=\"http://www.3gpp.org/ftp/Specs/archive/32_series/32607/schema/32607-70..." xmlns:bd=\"http://www.3gpp.org/ftp/Specs/archive/32_series/32607/schema/32607-70...">
> >     [....<moiLocation>imsServiceProfileId] => 1,suMSubscriptionProfileId=1,suMSubscriberProfileId=+14716000005_at,subscri ptionFunctionId=1,managedElementId=HSS1</moiLocation>
> > -------------------------------------
> >
> > and of course the only key is _resp_chargingIdx...
> >
> > any help will be appreciated.
> > Thanks!!!
> 
> Where did $pros come from? Can you show us the code you use to get the
> variable $pros?

Sorry, it's a spelling mistake..
It is props and it is from the code Alvaro supplied:


$props = parse_ini_file($prop_file, FALSE, INI_SCANNER_RAW); 
return array_key_exists($prop_key, $props) ? trim($props[$prop_key]) : FALSE; 

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.php


csiph-web