Thread: How to parse lines of a reponse?
Results 1 to 4 of 4
Related
-
Parse error, parse error unexpected T_variable. Help appreciated! Forum: PHP Forum
Replies: 8 -
Parse HTML Forum: PHP Forum
Replies: 4 -
Help: Double Or Triple Space Lines Forum: HTML Forum
Replies: 2
-
03-24-2005, 06:23 AM #1
How to parse lines of a reponse?
Hello,
I am obtaining HTML source code as a http response into a $response variable.
How can I go through the response content line by line and print out only the lines containing a certain phrase, for examle "id="?
Thank for your help in advance.
-
03-25-2005, 03:01 AM #2
you could just do it my way, and put all the lines into an array, then scan every array element and pick the ones you want...
Code:@aryresponse = split("\n", $response); for ($i = 0; $i <= $#aryresponse; $i=$i+1){ $aryresponse[$i] =~ s/\r//g; if($aryresponse[$i] =~ /id\=/){ print "$aryresponse[$i]\n"; } } @aryresponse = ();
$aryresponse[$i] =~ s/\r//g;
is because sometimes the chr(10) (one of the next line characters) are left behind. you dont actually need that, but i would use it
-
03-29-2005, 01:59 AM #3
-
03-29-2005, 02:27 AM #4
Cloudjiffy- PaaS for Developers
10-05-2020, 12:30 AM in Web Hosting Forum