piznac
-
Posts
261 -
Joined
-
Last visited
Posts posted by piznac
-
-
Hello all!
I have this array of objects:
Array ( [0] => stdClass Object ( [first_name] => test [last_name] => test [title] => test [id] => 34 [type] => 4 [manager] => 4 [email] => p@yahoo.com [date] => 2014-09-21 07:23:12 [status] => 2 [approval_date] => 2014-09-21 07:31:10 [assessment_id] => 1 [supervisor_approval] => 1 [manager_approval_date] => 2014-09-21 07:31:27 [mainmanger] => 3 ) [1] => stdClass Object ( [first_name] => test [last_name] => test [title] => test [id] => 34 [type] => 4 [manager] => 4 [email] => p@yahoo.com [date] => 2014-09-20 07:39:55 [status] => 2 [approval_date] => 2014-09-20 07:40:41 [assessment_id] => 3 [supervisor_approval] => 1 [manager_approval_date] => 2014-09-20 07:41:07 [mainmanger] => 3 ) [2] => stdClass Object ( [first_name] => jimmy john john [last_name] => john [title] => Lorad and Master [id] => 32 [type] => 4 [manager] => 3 [email] => j@j.com [date] => 2014-09-21 07:38:50 [status] => 2 [approval_date] => 2014-09-19 07:39:25 [assessment_id] => 2 [supervisor_approval] => 1 [manager_approval_date] => 2014-09-19 07:39:25 [mainmanger] => 0 ) )
Where "id" = the user ID.
If there are two or more entries for a user, I want to remove all but the most recent by the "approval_date",... So for the above example it would return:
Array ( [0] => stdClass Object ( [first_name] => test [last_name] => test [title] => test [id] => 34 [type] => 4 [manager] => 4 [email] => piznac@yahoo.com [date] => 2014-09-21 07:23:12 [status] => 2 [approval_date] => 2014-09-21 07:31:10 [assessment_id] => 1 [supervisor_approval] => 1 [manager_approval_date] => 2014-09-21 07:31:27 [mainmanger] => 3 ) [1] => stdClass Object ( [first_name] => jimmy john john [last_name] => john [title] => Lorad and Master [id] => 32 [type] => 4 [manager] => 3 [email] => j@j.com [date] => 2014-09-21 07:38:50 [status] => 2 [approval_date] => 2014-09-19 07:39:25 [assessment_id] => 2 [supervisor_approval] => 1 [manager_approval_date] => 2014-09-19 07:39:25 [mainmanger] => 0 ) )
I'm having a hard time wrapping my head around this concept, so I don't have any example code. And I don't really need or expect someone to code this for me,. just a push in the right direction would be awesome.
-
or since this is probably data from a database query, why not just sort the data in the query?
Geez such a simple solution and it never dawned on me,.. thanks a bunch man!
-
I have several arrays similar to this one:
[2] => Array ( [0] => Array ( [player] => piznac [playerId] => 1 [positionRow] => 0 ) [1] => Array ( [player] => [playerId] => [positionRow] => ) [2] => Array ( [player] => Player 3 [playerId] => 3 [positionRow] => 1 ) [3] => Array ( [player] => [playerId] => [positionRow] => ) )
How would I re-sort this array by the 'positionRow' key with still keeping the empty arrays. Something like this:
[2] => Array ( [0] => Array ( [player] => piznac [playerId] => 1 [positionRow] => 0 ) [1] => Array ( [player] => Player 3 [playerId] => 3 [positionRow] => 1 ) [2] => Array ( [player] => [playerId] => [positionRow] => ) [3] => Array ( [player] => [playerId] => [positionRow] => ) )
-
Wow, holy crap I could have sworn I tried that. But a quick script later and now it worked fine.
public function testImageConvert() { $query = $this->db->query("SELECT Picture FROM `ItemPicture` LIMIT 1"); if($query->num_rows() > 0) { $row = $query->row(); file_put_contents('test.jpg',$row->Picture); } return false; }
Thanks for the help!!! - I must have done something strange last time I tried this.
-
Hi!
I got stuck with a project utilizing a DB full of images in a BLOB format. It's a basic shopping cart and I looped through the images with something like this:
<img src="data:image/jpeg;base64,<?php echo base64_encode($content); ?>" width="100" />
Where $content equals the Blob data.
As I thought, this is laggy as can be(trying to loop and re size is a nightmare slow.). So I want to write a script to convert them all to images and then save to file. And then of course write a line to a new table to use(since I always use the link in DB and image in file system technique, I have no knowledge on this Blob thing).
I have tried many things, however I can't seem to get any images to save as actual files(There seems to be tons of articles on saving as Blob and re displaying image, but not on saving it back to file.). Sadly my pc just crashed so I don't have any of the code where I tried. I don't need it written, just a nudge in the write direction I can write everything up until the actual save to this directory portion. Just need that nudge with that part.
Thanks for anyone's time for this!!
**Edit - Just noticed my sig. None of that data is correct at this point. I can provide that data if needed. php 5.XX of course.
-
Ok cool,. Ill check that out,. thanks.
-
bumpy bump bump?
-
array_filter looks like a good option, but I don't understand how to make a callback to show the values. Am I getting closer? lol
-
How can I limit a foreach loop based on the value of an array. I tried something like this and it didn't work:
foreach($options as $key => $value) { if($key != 'sortby' || $key != 'sortdirection') { $this->db->where($key,$value); } }
This what I'm sending it:
array('lad_id' => $ladid, 'sortby' => 'score', 'sortdirection' => 'ASC')
I saw that I could do something like this:
array_slice($options, 0, 2)
However I wont know the numbers, I would like to limit it by the array values. Is there a way to do this?
Thank you.
-
Im a bit confused by the last comment. I want to have option categories for each product and options for each category. What is is displaying right nwo is this:
Top Draft Stop
NO Top Draft Stop
HOOD-recommended for exterior mount aplications
3 FT Top Draft Stop
Curtain Color Orientation
NO Hood
Where it should display:
Top Draft Stop
NO Top Draft Stop
3 FT Top Draft Stop
HOOD-recommended for exterior mount aplications
NO Hood
Curtain Color Orientation
-
Ok I will start the research process,. thanks for the tips,. if you have any more Im all ears!
-
Yeah thats what I figured you guys would say lol. Would something like this work
<?php function pro_options($id){ // Construct our join query $query = "SELECT * ". "FROM pro_op_main , prod_op ,prodsub_op ". "WHERE pro_op_main.pro_id = '$id' && pro_op_main.op_id = prod_op.op_id && prod_op.op_id = prodsub_op.prod_subid"; $result = mysql_query($query) or die(mysql_error()); // Print out the contents of each row into a table while($row = mysql_fetch_array($result)){ echo $row['prod_op.name']. " - ". $row['prod_op.desc']; echo "<br />"; echo $row['prodsub_op.name']; echo "<br />"; } } ?>
-
Sorry was tabbing and hit the eneter key by accident,. please check again.
-
I have three tables:
Table A contains all product id and a option id.
Table B contains all option types,. ie name,desc,option id, product id.
Tabke c contains the actual sub options ie name,desc, add price, option id, sub option id.
Products Table A Table B Table C
pro_id ------------prod_id Name Name
option_id--------option_id----option_sub_id
desc desc
image price
image
Ok what Im trying to do is list custom options of a given product. I may have gone about this backwards or just plain strange, but here is what Im hoping to do:
Based on a product Id var:
Table B.name
Table B.desc
<br>
Then list each option based of Table B.option_id:
Table C.name
Table C.desc
ANd repeat this
Table B.name
Table B.desc
<br>
Then list each option based of Table B.option_id:
Table C.name
Table C.desc
Table C.name
Table C.desc
Table C.name
Table C.desc
Table B.name
Table B.desc
<br>
Then list each option based of Table B.option_id:
Table C.name
Table C.desc
Now Im confised,. here is what I have tried:
<?php function pro_options($id){ $sql = "SELECT * FROM `pro_op_main` WHERE `pro_id` = '$id' "; $result = mysql_query($sql); $row = mysql_fetch_array($result); $num_rows = mysql_num_rows($result); do{ $opid = $row['op_id']; //get subid data $sql2 = "SELECT * FROM `prod_op` WHERE `op_id` = '$opid' "; $result2 = mysql_query($sql2); $row2 = mysql_fetch_array($result2); $num_rows2 = mysql_num_rows($result2); do{ $op_id = $row2['op_id']; $opname = $row2['name']; $op_id2 = explode(" ",$op_id); foreach($op_id2 as $key){ //get option values $sql3 = "SELECT * FROM `prodsub_op` WHERE `prodsub_op_id` = '$key' "; $result3 = mysql_query($sql3); $row3 = mysql_fetch_array($result3); $num_rows3 = mysql_num_rows($result3); echo "$opname<br />"; echo $row3['name']; } }while($row2 = mysql_fetch_array($result2)); }while($row = mysql_fetch_array($result)); } ?>
&&
<?php function pro_options($id){ $sql = "SELECT * FROM `pro_op_main` WHERE `pro_id` = '$id' "; $result = mysql_query($sql); $row = mysql_fetch_array($result); $num_rows = mysql_num_rows($result); //make array of results id do{ $opid = $row['op_id']; $opidarray = explode(" ",$opid); print_r($opidarray); foreach($opidarray as $id){ $sql2 = "SELECT * FROM `prod_op` WHERE `op_id` = '$id' "; $result2 = mysql_query($sql2); $row2 = mysql_fetch_array($result2); $num_rows2 = mysql_num_rows($result2); do{ echo "<br />"; echo "<b>"; echo $row2['name']; echo "</b>"; echo "<br />"; echo $row2['desc']; echo "<br />"; $id2 = $row2['op_id']; $op_sub_id = explode(" ",$id2); foreach($op_sub_id as $newid){ //get option values $sql3 = "SELECT * FROM `prodsub_op` WHERE `prodsub_op_id` = '$newid' "; $result3 = mysql_query($sql3); $row3 = mysql_fetch_array($result3); $num_rows3 = mysql_num_rows($result3); do{ echo "<br />"; echo $row3['name']; echo "<br />"; }while($row3 = mysql_fetch_array($result3)); } }while($row2 = mysql_fetch_array($result2)); } }while($row = mysql_fetch_array($result)); ?>
What this is returning is correct but the table c results are not returning under the correct table B headers. Can you guys understand this?
-
ahh ok I think I'm getting it. It searches after the exact word for everything (whitespace or not) before the next line break?
-
That is an awesome start,.. thanks a bunch bro. Now to try to figure out what you did. So you just matched on the keywords then that puts them in an array? Now how did you get the exact info after the keywords? I'm going to study this for a while,.. thanks again for taking the time!
-
sadly yes thats how it comes out. Can't I search for "Name:", "Ally:","Town Size" & "Player" in a preg statement or something like that? But then how do I see whats after it,.. the results could be of various sizes for each of the categories. Town Size will likely remain a two digit int for quite some time, but thats it the rest alpha numeric of various sizes.
Wait this is it after it is pasted in a text area,. is there a way to keep the orginal line breaks and would that make this easier? Here is an example of how it was before pasting it:
Ikariam
Live the ancient world!
You are here:
World > Adatia[42:85]
Info
Attention: This area of the page is updated when you select a town!
Actions
Attention: This area of the page is updated when you select a town!
Towns on Adatia
*
Guangzhou (i)
o Name: Guangzhou
o Town size: 17
o Player: DarthExile Send Message
o Ally: -
o Diplomacy
o Transport goods
o Pillage
o Blockade harbor
o Send out spy
*
Building ground
*
SG-1
o Name: SG-1
o Town size: 13
o Player: wj0912 Send Message
o Ally: WRL Send Message
o Diplomacy
o Transport goods
o Pillage
o Send out spy
*
Oceanside (u)
o Name: Oceanside
o Town size: 16
o Player: Gunner08 Send Message
o Ally: -
o Diplomacy
o Send out spy
*
Building ground
*
Sphinx
o Name: Sphinx
o Town size: 20
o Player: Bean Send Message
o Ally: WRL Send Message
*
beercity
o Name: beercity
o Town size: 21
o Player: Cyclops Send Message
o Ally: WRL Send Message
o Diplomacy
o Transport goods
o Pillage
o Send out spy
*
004
o Name: 004
o Town size: 8
o Player: rjrsson Send Message
o Ally: WRL Send Message
o Diplomacy
o Transport goods
o Pillage
o Send out spy
*
Hoodville 2 (u)
o Name: Hoodville 2
o Town size: 17
o Player: Sniped2 Send Message
o Ally: -
o Diplomacy
o Send out spy
*
Christopilis (i)
o Name: Christopilis
o Town size: 11
o Player: WRLChris Send Message
o Ally: WRL Send Message
o Diplomacy
o Transport goods
o Pillage
o Send out spy
*
LOLbeer (i)
o Name: LOLbeer
o Town size: 13
o Player: redratfish Send Message
o Ally: WRL Send Message
o Diplomacy
o Transport goods
o Pillage
o Send out spy
*
New Zlin
o Name: New Zlin
o Town size: 20
o Player: WRLPeer de Beer Send Message
o Ally: WRL Send Message
o Diplomacy
o Transport goods
o Pillage
o Send out spy
*
Building ground
*
hydro man
o Name: hydro man
o Town size: 17
o Player: terrinater Send Message
o Ally: WRL Send Message
o Diplomacy
o Transport goods
o Pillage
o Send out spy
*
New Dystopia
o Name: New Dystopia
o Town size: 20
o Player: JangosAgony Send Message
o Ally: WRL Send Message
o Diplomacy
o Transport goods
o Pillage
o Send out spy
*
king of saians (u)
o Name: king of saians
o Town size: 21
o Player: rogobodo Send Message
o Ally: WRL Send Message
o Diplomacy
o Send out spy
Special places on Adatia
* Forest
* Vines
* Colossus
Imprint
Town navigation
* Current town:
[42:85] Sphinx
o [42:82] Manticore
o [43:84] Gryphon
o [42:85] Sphinx
o [43:85] Dune
o [45:84] Osheanus
* Previous Town
* Next Town
* Show World
* Show Island
* Show Town
Resources of your Empire
* Trade ships: 0(51)
* Gold: 570,466
* Income: 234
Town´s resources
* Population: 777 (1,878)
* Action Points: 6
* Building material: 12,742
Storage capacity: 81,024
* Wine: 7,263
Storage capacity: 35,232
* Marble: 2,795
Storage capacity: 35,232
* Crystal Glass: 143
Storage capacity: 35,232
* Sulfur: 10,000
Storage capacity: 35,232
Overviews
* Towns To Overview
* Military To Overview
* Research To Overview
* Diplomacy To Overview
© 2008 by Gameforge. All rights reserved. Rules T&Cs Imprint
Other Options
* Help
* Ikariam PLUS (0)
* Highscore
* Options
* Board
* Logout
* v.0.2.7
* 25.08.2008 23:38:52
-
Ok so I dont even know where to start. I need to take some text, like this paste:
Ikariam Live the ancient world! You are here: World > Adatia[42:85] Info Attention: This area of the page is updated when you select a town! Actions Attention: This area of the page is updated when you select a town! Towns on Adatia * Guangzhou (i) o Name: Guangzhou o Town size: 17 o Player: DarthExile Send Message o Ally: - o Diplomacy o Transport goods o Pillage o Blockade harbor o Send out spy * Building ground * SG-1 o Name: SG-1 o Town size: 13 o Player: wj0912 Send Message o Ally: WRL Send Message o Diplomacy o Transport goods o Pillage o Send out spy * Oceanside (u) o Name: Oceanside o Town size: 16 o Player: Gunner08 Send Message o Ally: - o Diplomacy o Send out spy * Building ground * Sphinx o Name: Sphinx o Town size: 20 o Player: Bean Send Message o Ally: WRL Send Message * beercity o Name: beercity o Town size: 21 o Player: Cyclops Send Message o Ally: WRL Send Message o Diplomacy o Transport goods o Pillage o Send out spy * 004 o Name: 004 o Town size: 8 o Player: rjrsson Send Message o Ally: WRL Send Message o Diplomacy o Transport goods o Pillage o Send out spy * Hoodville 2 (u) o Name: Hoodville 2 o Town size: 17 o Player: Sniped2 Send Message o Ally: - o Diplomacy o Send out spy * Christopilis (i) o Name: Christopilis o Town size: 11 o Player: WRLChris Send Message o Ally: WRL Send Message o Diplomacy o Transport goods o Pillage o Send out spy * LOLbeer (i) o Name: LOLbeer o Town size: 13 o Player: redratfish Send Message o Ally: WRL Send Message o Diplomacy o Transport goods o Pillage o Send out spy * New Zlin o Name: New Zlin o Town size: 20 o Player: WRLPeer de Beer Send Message o Ally: WRL Send Message o Diplomacy o Transport goods o Pillage o Send out spy * Building ground * hydro man o Name: hydro man o Town size: 17 o Player: terrinater Send Message o Ally: WRL Send Message o Diplomacy o Transport goods o Pillage o Send out spy * New Dystopia o Name: New Dystopia o Town size: 20 o Player: JangosAgony Send Message o Ally: WRL Send Message o Diplomacy o Transport goods o Pillage o Send out spy * king of saians (u) o Name: king of saians o Town size: 21 o Player: rogobodo Send Message o Ally: WRL Send Message o Diplomacy o Send out spy Special places on Adatia * Forest * Vines * Colossus Imprint Town navigation * Current town: [42:85] Sphinx o [42:82] Manticore o [43:84] Gryphon o [42:85] Sphinx o [43:85] Dune o [45:84] Osheanus * Previous Town * Next Town * Show World * Show Island * Show Town Resources of your Empire * Trade ships: 0(51) * Gold: 570,466 * Income: 234 Town´s resources * Population: 777 (1,878) * Action Points: 6 * Building material: 12,742 Storage capacity: 81,024 * Wine: 7,263 Storage capacity: 35,232 * Marble: 2,795 Storage capacity: 35,232 * Crystal Glass: 143 Storage capacity: 35,232 * Sulfur: 10,000 Storage capacity: 35,232 Overviews * Towns To Overview * Military To Overview * Research To Overview * Diplomacy To Overview © 2008 by Gameforge. All rights reserved. Rules T&Cs Imprint Other Options * Help * Ikariam PLUS (0) * Highscore * Options * Board * Logout * v.0.2.7 * 25.08.2008 23:38:52First I need to pick out some data and remove the rest. I will highlight what I need:
Ikariam Live the ancient world! You are here: World > Adatia[42:85] Info Attention: This area of the page is updated when you select a town! Actions Attention: This area of the page is updated when you select a town! Towns on Adatia * Guangzhou (i) o Name: Guangzhou o Town size: 17 o Player: DarthExile Send Message o Ally: - o Diplomacy o Transport goods o Pillage o Blockade harbor o Send out spy * Building ground * SG-1 o Name: SG-1 o Town size: 13 o Player: wj0912 Send Message o Ally: WRL Send Message o Diplomacy o Transport goods o Pillage o Send out spy * Oceanside (u) o Name: Oceanside o Town size: 16 o Player: Gunner08 Send Message o Ally: - o Diplomacy o Send out spy * Building ground * Sphinx o Name: Sphinx o Town size: 20 o Player: Bean Send Message o Ally: WRL Send Message * beercity o Name: beercity o Town size: 21 o Player: Cyclops Send Message o Ally: WRL Send Message o Diplomacy o Transport goods o Pillage o Send out spy * 004 o Name: 004 o Town size: 8 o Player: rjrsson Send Message o Ally: WRL Send Message o Diplomacy o Transport goods o Pillage o Send out spy * Hoodville 2 (u) o Name: Hoodville 2 o Town size: 17 o Player: Sniped2 Send Message o Ally: - o Diplomacy o Send out spy * Christopilis (i) o Name: Christopilis o Town size: 11 o Player: WRLChris Send Message o Ally: WRL Send Message o Diplomacy o Transport goods o Pillage o Send out spy * LOLbeer (i) o Name: LOLbeer o Town size: 13 o Player: redratfish Send Message o Ally: WRL Send Message o Diplomacy o Transport goods o Pillage o Send out spy * New Zlin o Name: New Zlin o Town size: 20 o Player: WRLPeer de Beer Send Message o Ally: WRL Send Message o Diplomacy o Transport goods o Pillage o Send out spy * Building ground * hydro man o Name: hydro man o Town size: 17 o Player: terrinater Send Message o Ally: WRL Send Message o Diplomacy o Transport goods o Pillage o Send out spy * New Dystopia o Name: New Dystopia o Town size: 20 o Player: JangosAgony Send Message o Ally: WRL Send Message o Diplomacy o Transport goods o Pillage o Send out spy * king of saians (u) o Name: king of saians o Town size: 21 o Player: rogobodo Send Message o Ally: WRL Send Message o Diplomacy o Send out spy Special places on Adatia * Forest * Vines * Colossus Imprint Town navigation * Current town: [42:85] Sphinx o [42:82] Manticore o [43:84] Gryphon o [42:85] Sphinx o [43:85] Dune o [45:84] Osheanus * Previous Town * Next Town * Show World * Show Island * Show Town Resources of your Empire * Trade ships: 0(51) * Gold: 570,466 * Income: 234 Town´s resources * Population: 777 (1,878) * Action Points: 6 * Building material: 12,742 Storage capacity: 81,024 * Wine: 7,263 Storage capacity: 35,232 * Marble: 2,795 Storage capacity: 35,232 * Crystal Glass: 143 Storage capacity: 35,232 * Sulfur: 10,000 Storage capacity: 35,232 Overviews * Towns To Overview * Military To Overview * Research To Overview * Diplomacy To Overview © 2008 by Gameforge. All rights reserved. Rules T&Cs Imprint Other Options * Help * Ikariam PLUS (0) * Highscore * Options * Board * Logout * v.0.2.7 * 25.08.2008 23:38:52Everything else I need to be gone. Now Im lost. I would like to use this data to send to a mysql db. That part I can handle, but getting this data in a usaable format,.. I seem to be lost.
I need something like this:
<town>
<city>
<name>$name</name>
<townsize>$ts</townsize>
<pname>$playername</pname>
<ally>$ally</ally>
</city>
</town>
Im not asking anyone to write it for me,. but some tips would great. Thanks!
-
Hey guys,.. there has got to be a way to do this or a work around. Example:
<?php function home(){ $con = '<span class="main-text">Well well well,.. it would seem you have found your way to the brotherhood of {WRL}. More then a simple gaming clan, we are what you would call a movement. Honor, respect & duty,.. these are words we take seriously. Honor your clan, respect to all, & and your duty to your clan.<br /> <br /> Here rank matters very little, and although we do strive to be the best we can be. Your loyality to our cause is of the greatest importance. You will come to find that we are not the typical gaming clan. We do not promote for skills or even consider it that important. We do not attack other clans of players with any evil intent. Although we do plan and host many wars, these are for fun or competition only.<br /> <br /> Also we support many games and are constanly expanding. Our forums are very active and our site recieves over 1 million hits a month. So welcome to the brotherhood,.. follow the rules, treat people with respect and reserve your spot in history with the {WRL} movement. Make sure that you read the rules section and such</span><br /> <br /> <br /><table width="95%" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td width="2%" class="head_repeat"><img src="images/mid-left-head.gif" width="9" height="25" /></td> <td width="96%" class="head_repeat style7">Recent Post</td> <td width="2%" class="head_repeat"><div align="right"><img src="images/mid-right-head.gif" width="9" height="25" /></div></td> </tr> <tr> <td height="13" colspan="3" bgcolor="#CECFCE" class="menu-bor">' . ssi_recentTopics() . '</td> </tr> </table> <br /> <table width="95%" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td width="2%" class="head_repeat"><img src="images/mid-left-head.gif" width="9" height="25" /></td> <td width="96%" class="head_repeat style7">Gaming News </td> <td width="2%" class="head_repeat"><div align="right"><img src="images/mid-right-head.gif" width="9" height="25" /></div></td> </tr> <tr> <td colspan="3" bgcolor="#CECFCE" class="menu-bor"><br />' . include ("rss.php") . '<br /></td> </tr> </table>'; } ?>
This displays the function "ssi_recentTopics() " no matter what happens. Is there way to hold this data inside the string so I can call it where I need it?
-
Yes just change your form method to GET instead of POST
-
Yes that is what I was looking for. After I type the last post I though why am I trying to preg it twice?..lol... Thanks guys.
-
Ok,... Im not getting anything returned on that. Most likely cause something else is messed up in my script,.. could you guys take a look at it and see maybe where I went wrong?
<?php $keyword = "embroidery"; $url1 = "http://www.articlebiz.com/browse.jsp?keywords=$keyword"; $userAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; DigExt; SV1; .NET CLR 2.0.50727; .NET CLR 1.1.4322)"; $ch = curl_init(); curl_setopt($ch, CURLOPT_USERAGENT, $userAgent); curl_setopt($ch, CURLOPT_URL,$url1); curl_setopt($ch, CURLOPT_FAILONERROR, true); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_AUTOREFERER, true); curl_setopt($ch, CURLOPT_RETURNTRANSFER,true); curl_setopt($ch, CURLOPT_TIMEOUT, 10); $html = curl_exec($ch); if (!$html) { echo "<br />cURL error number:" .curl_errno($ch); echo "<br />cURL error:" . curl_error($ch); exit; } $pattern = "/\<a class=l href=\"([a-z0-9\.\"'\/:\-_?&=]+)\"/i"; //for($i=0; $i<10000; $i++) //{ preg_match_all(("/(href[= = ])(.*?)(>)(.*?)(<\/a>+)/i"), $html, $matches); foreach($matches[2] as $va){ $merge = array_merge($va); foreach($merge as $new){ $new2 = explode('"',$new); //echo "$new2[1]<br />"; preg_match_all("/(http:\/\/www\.articlebiz\.com\/article\/.*?)\n/i", $new2[1], $matches2); print_r($matches2); //print_r($matches2); //foreach($matches2 as $new33){ //echo "$new33<br />"; //print_r($new33); //} } //$nomerge = explode('"',$merge); //echo $nomerge[0]; } //$merger = array_merge($va); /*foreach($va as $link){ echo "$link<br />"; } } */ //} ?>
-
<?php $headers = "From: sales@sewnice.biz"; mail($to, $subject, $message, $headers) ?>
Is that what you are looking for?
-
Say I have a list of urls, and there is a certain pattern example:
http://www.articlebiz.com/featured_articles/1/
http://www.articlebiz.com/recently_added_articles/1/
http://www.articlebiz.com/most_viewed_articles/1/
http://www.articlebiz.com/commented_articles/1/
http://www.articlebiz.com/article_search/
http://www.articlebiz.com/submit_article/
http://www.articlebiz.com/author_tos/
http://www.articlebiz.com/rss_article_feeds/
http://www.articlebiz.com/publisher_tos/
http://www.articlebiz.com/article/102736-1-phulkari-art-of-punjab-a-novel-indian-craft/
http://www.articlebiz.com/article/98041-1-plus-size-denims-and-jeans/
http://www.articlebiz.com/article/94329-1-moroccan-bedrooms-create-your-harem-style-room/
http://www.articlebiz.com/article/93949-1-plus-size-jeans-for-women/
http://www.articlebiz.com/article/94872-1-wedding-dress-trains/
http://www.articlebiz.com/article/94878-1-wedding-gown-necklines/
http://www.articlebiz.com/article/94871-1-wedding-veils/
http://www.articlebiz.com/article/94870-1-wedding-headpieces/
http://www.articlebiz.com/article/89155-1-to-frame-or-not-to-frame-that-is-the-question/
http://www.articlebiz.com/article/91428-1-apply-correctly-make-up/
http://www.articlebiz.com/article/85574-1-defending-your-denim-how-to-keep-your-favorite-jeans-in-perfect-condition/
http://www.articlebiz.com/article/84445-1-crochet-tips-you-need-to-know/
http://www.articlebiz.com/article/78848-1-do-you-want-your-presents-to-stand-out/
http://www.articlebiz.com/article/76779-1-memory-quilts/
http://www.articlebiz.com/article/77512-1-silk-garments/
http://www.articlebiz.com/browse.jsp?keywords=embroidery&index=2
http://www.articlebiz.com/browse.jsp?keywords=embroidery&index=3
http://www.articlebiz.com/browse.jsp?keywords=embroidery&index=4
http://www.articlebiz.com/browse.jsp?keywords=embroidery&index=5
http://www.articlebiz.com/browse.jsp?keywords=embroidery&index=6
http://www.articlebiz.com/browse.jsp?keywords=embroidery&index=7
http://www.articlebiz.com/browse.jsp?keywords=embroidery&index=2
http://www.articlebiz.com/terms_of_service/
http://www.articlebiz.com/privacy_policy/
http://www.articlebiz.com/contact_us/
http://www.articlebiz.com/submit_article/
http://www.articlebiz.com/sign_in.jsp
And I want to get rid of any results that dont start with this:
http://www.articlebiz.com/article/
I tried this:
preg_match_all("/http:\/\/www.articlebiz.com\/article/\")
but it simplys returns this:
http://www.articlebiz.com/article/
for each url with that in it. Now how to I also inculde what is after that? I tried this:
//preg_match_all("/http:\/\/www.articlebiz.com\/article/([a-z0-9\.\"'\/:\-_?&=]+)i")), $new, $matches2);
but its not working. Im new to the preg crap any help?
Sort array of objects by date in objects
in PHP Coding Help
Posted · Edited by piznac
Yeah I assumed that would be the first question I would get. I am doing a lot more to this query after the fact when building this array. This particular part is an add on after the fact,.. so Im trying to avoid re-writing everything.
Ok sounds solid,. thank you!