![]() |
![]() |
![]() |
||||
Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact us. |
![]() ![]() |
|
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed. |
|
Thread Tools |
![]() |
#1 |
Confirmed User
Join Date: Oct 2003
Location: Atlanta
Posts: 2,840
|
PHP code help needed.
Hi i'm stuck on where to add my Do While Loop statement ... below is the section of the coding that is being processed. what is happening is the source is examined and the version codes are grabbed. but, it needs to loop through the source and grab all version codes and not just the first one.
thanks in advance Code:
$resp = curl_exec($ch); //echo "$resp\n"; curl_close($ch); $startkey = "<024version>"; $stopkey = "</024version>"; $startpos = strpos($resp, $startkey); if ($startpos !hahahaha false) { $startpos += strlen($startkey); $endpos = strpos($resp, $stopkey, $startpos); $len = ($endpos - $startpos); $writecontent .= substr($resp, $startpos, $len)."\n"; echo "$writecontent\n"; } $fp = fopen($outputfile,"w"); fwrite($fp,$writecontent); fclose($fp); |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#2 |
<&(©¿©)&>
Industry Role:
Join Date: Jul 2002
Location: Chicago
Posts: 47,882
|
use regexp not some gay strpos setup you have...
__________________
Custom Software Development, email: woj#at#wojfun#.#com to discuss details or skype: wojl2000 or gchat: wojfun or telegram: wojl2000 Affiliate program tools: Hosted Galleries Manager Banner Manager Video Manager ![]() Wordpress Affiliate Plugin Pic/Movie of the Day Fansign Generator Zip Manager |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#3 | |
Confirmed User
Join Date: Oct 2003
Location: Atlanta
Posts: 2,840
|
Quote:
also back to my original question where should my do loop go? |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#4 |
Confirmed User
Join Date: Mar 2006
Location: southern california
Posts: 640
|
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#5 | |
Confirmed User
Join Date: May 2005
Posts: 2,737
|
Quote:
![]() |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#6 | |
Confirmed User
Join Date: May 2005
Posts: 2,737
|
Quote:
http://us3.php.net/preg_match_all |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#7 |
Confirmed User
Join Date: Oct 2003
Location: Atlanta
Posts: 2,840
|
its not all xml =/
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#8 |
Confirmed User
Join Date: Mar 2006
Location: southern california
Posts: 640
|
ahhh theres a function for just about everything
![]() |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#9 |
Confirmed User
Industry Role:
Join Date: Nov 2005
Posts: 8,170
|
Woah, your code just took me back to 1995.. thank ya
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#10 | |
Confirmed User
Join Date: Oct 2003
Location: Atlanta
Posts: 2,840
|
Quote:
Code:
preg_match_all('|<024version>(.*?)</024version>|',$resp,$writecontent); |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#11 | |
Confirmed User
Join Date: May 2005
Posts: 2,737
|
Quote:
|
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#12 |
Confirmed User
Join Date: Oct 2003
Location: Atlanta
Posts: 2,840
|
ok seems to be working except one issue... damn array.. how do you pull the results from the array... it's listing them one i do a print_r but but will not output them to the. all i'm getting in the file is Array repeated on each line
Code:
$lookfor ="|<024version>(.*?)</024version>|Ui"; preg_match_all($lookfor,$html,$results); print_r($results[1]); $writecontent .= "$results[1]\n"; echo "$result[1]\n"; $fp = fopen($outputfile,"a"); fwrite($fp,$writecontent); fclose($fp); |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#13 |
Confirmed User
Join Date: Jun 2004
Posts: 689
|
Code:
$lookfor = '|<024version>(.*)</024version>|Ui'; preg_match_all($lookfor,$html,$results,PREG_PATTERN_ORDER); $writecontent = ''; for ($c = 0; $c < sizeof($results[1]); $c++) { $writecontent .= $results[1][$c]."\n"; } $fp = fopen($outputfile,'a'); fwrite($fp,$writecontent); fclose($fp);
__________________
Webmasters! Looking for new affiliate programs to promote? Affiliate Program Search <-- Search for programs with FHGs, RSS feed, specific niche sponsors, ... |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#14 |
Confirmed User
Join Date: Oct 2003
Location: Atlanta
Posts: 2,840
|
thank you =)
|
![]() |
![]() ![]() ![]() ![]() ![]() |