supermerc Posted January 7, 2009 Share Posted January 7, 2009 Hi, Im trying to make a script that will go to a site using cURL and go to a page where it shows things like: TehFreak Deposited Kitty Thong (7821341) 01/07/2009 TehFreak Deposited Augment (7821383) 01/07/2009 TehFreak Deposited Booty Shorts (7795327) 01/07/2009 almightywoodygod Deposited Kilt (7786725) 01/07/2009 MASTAPLAYA Awarded Leg Guards of Silent Death (7582935) to TehFreak 01/06/2009 MASTAPLAYA Awarded Leg Guards of Silent Death (7714246) to TehFreak 01/06/2009 BoneThugz Awarded Infernal Protectorate (7714002) to Popstarmike 01/06/2009 BoneThugz Deposited Precision Glove of Champions (7775332) 01/06/2009 BoneThugz Deposited Precision Glove of Champions (7666483) 01/06/2009 etc.. What I want my script to add everything in that page that havent already added to database. For example for each line I want the thing to go in seperate categories, like in BoneThugz Deposited Precision Glove of Champions (7666483) 01/06/2009 BoneThugz would go in the field name, Deposited would be in the field action, Precision Glove of Champions would go in the field item, 7666483 would go in the field id, and 01/06/2009 would be date. Does anyone know how to do that or guide me or anything? Would be greatly appreciated. Link to comment https://forums.phpfreaks.com/topic/139922-curl-help/ Share on other sites More sharing options...
Brian W Posted January 7, 2009 Share Posted January 7, 2009 can u modify the format that that information comes to you? If you could get that into something like a CSV file, you could find 100+ tutorials or atleast your data may be easier to manage. Something like "TehFreak";"Deposited";"Kitty Thong (7821341)";"01/07/2009" "TehFreak";"Deposited";"Augment (7821383)";"01/07/2009" Link to comment https://forums.phpfreaks.com/topic/139922-curl-help/#findComment-732065 Share on other sites More sharing options...
supermerc Posted January 7, 2009 Author Share Posted January 7, 2009 Nope I cant modify the format :S Link to comment https://forums.phpfreaks.com/topic/139922-curl-help/#findComment-732066 Share on other sites More sharing options...
Brian W Posted January 7, 2009 Share Posted January 7, 2009 Assuming the first word in the second returned column is the action: <?php $Text = " TehFreak Deposited Kitty Thong (7821341) 01/07/2009 TehFreak Deposited Augment (7821383) 01/07/2009 TehFreak Deposited Booty Shorts (7795327) 01/07/2009 almightywoodygod Deposited Kilt (7786725) 01/07/2009 MASTAPLAYA Awarded Leg Guards of Silent Death (7582935) to TehFreak 01/06/2009 MASTAPLAYA Awarded Leg Guards of Silent Death (7714246) to TehFreak 01/06/2009 BoneThugz Awarded Infernal Protectorate (7714002) to Popstarmike 01/06/2009 BoneThugz Deposited Precision Glove of Champions (7775332) 01/06/2009 BoneThugz Deposited Precision Glove of Champions (7666483) 01/06/2009"; $Text = str_replace(" ", " ", $Text); $Lines = explode("\n", $Text); $i=0; foreach($Lines as $Line){ $Column = explode(" ", $Line); $Name = trim($Column[0]); $List = explode(" ", trim($Column[1]), 2); $Action = trim($List[0]); $What = trim($List[1]); $Date = trim($Column[2]); echo $Name." - ".$Action." - ".$What." - ".$Date."<br />"; } ?> That will give you the different pieces (which I have being echoed out for testing reasons) Link to comment https://forums.phpfreaks.com/topic/139922-curl-help/#findComment-732077 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.