Jump to content

CraftHell

New Members
  • Posts

    9
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

CraftHell's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I could just make the one part grab the info and database it, and the sercond to grab the prices and add them to the items in the newly created database.. running the script seperate and not crashing the server Then calling the info back for display on my end only from the mySQL database But this would mean i would have to rewrite my scripts, and send a apology letter to my host and try and get my service back lmfao..
  2. I codded this piece by piece yea they actually shutdown my server right after i posted this topic Is there anyway i can get the info i need without crashing servers ?
  3. Okay I believe I have a $page_contents problem cause im calling 2 functions to grab data from the same site but at 2 different location at the same time. The script works just like i want it but when theres too many items to grab it wont load the page.. Is there anything i can do? It will load over 1000's of items down a list using just one $page_contents.. but when i try both im lucky if i can see a list of 5 items.. Cause see one function will grab a list of specified items (page.php?load=) and the next function will grab the price for each item from their own page at the same time.. So i guees if i wanna load 10 items, and have the script grab their prices from their individual pages, thats i guess 11 pages loaded in the background? Heres the full code including the html: <?php ////////////////////////////////////////////////////////////////////////////// // // This function will grab item name, id#, and start a table. // Usage: (thispage.php?load=http://ffxiv.yg.com/items?blahblahblah) // function grabdata($site){ $page_contents = file_get_contents($site); $pattern = '/\/item\/([a-z,-]+[^gil])\?id\=([0-9,]+)/'; preg_match_all($pattern, $page_contents, $matches); $arrRetList = array(); if(!empty($matches)){ foreach($matches as $item) { foreach($item as $pos => $row){ $arrRetList[$pos][] = $row; } } foreach($arrRetList as $row){ echo "<tr><td align='left'valign='center'><p class='items'><a href='http://ffxiv.yg.com" . $row[0] . "'>Unknown Item</a></p></td>"; grabprice($row[0]); echo "</tr>"; } } } ////////////////////////////////////////////////////////////////////////////// // // This function will use the data grabbed in function grabdata to go to // individual item pages and get their resell value at normal, +1, +2, +3 // and finish the table. // function grabprice($price){ $pricesite = "http://ffxiv.yg.com" . $price; $pattern = '/([Normal,+1,+2,+3]+)<\/td><td align=\"right\">([0-9,]+)<\/td><\/tr>/'; $page_contents = file_get_contents($pricesite); $matches = array(); preg_match_all($pattern, $page_contents, $matches); echo "<td align='center'valign='center'><p class='items'>"; ////////////////////////// // Array Key ////////////////////////// // [1][0] = Normal // [1][1] = +1 // [1][2] = +2 // [1][3] = +3 // [2][0] = NQ Price // [2][1] = +1 Price // [2][2] = +2 Price // [2][3] = +3 Price ////////////////////////////////////////////////////////////////////////////// // // If the price isnt found for normal quality it will return a 0 // if ($matches[2][0] == "") { echo "0"; } else { echo $matches[2][0]; } echo "g</p></td><td align='center'valign='center'><p class='items'>"; ////////////////////////////////////////////////////////////////////////////// // // If the price isnt found for +1 quality it will return a 0 // if ($matches[2][1] == "") { echo "0"; } else { echo $matches[2][1]; } echo "g</p></td><td align='center'valign='center'><p class='items'>"; ////////////////////////////////////////////////////////////////////////////// // // If the price isnt found for +2 quality it will return a 0 // if ($matches[2][2] == "") { echo "0"; } else { echo $matches[2][2]; } echo "g</p></td><td align='center'valign='center'><p class='items'>"; ////////////////////////////////////////////////////////////////////////////// // // If the price isnt found for +3 quality it will return a 0 // if ($matches[2][3] == "") { echo "0"; } else { echo $matches[2][3]; } echo "g</p></td>"; } echo "<table align='center' border='0' cellpadding='0' cellspacing='0' width='100%'> <tr> <td align='left' valign='center'> <p class='items'></p> </td> <td align='center'valign='center'> <p class='items'><b>Normal</b></p> </td> <td align='center'valign='center'> <p class='items'><b>+1</b></p> </td> <td align='center'valign='center'> <p class='items'><b>+2</b></p> </td> <td align='center'valign='center'> <p class='items'><b>+3</b></p> </td> </tr>"; grabdata($_GET['load']); echo "</table>"; ?>
  4. :'( Anyone know what im doing wrong in this code? :-\
  5. Hi I appreciate everyone who helped me with my other problem trying to call my Array() I had issues with. Heres what that looks like http://crafted.horizon-host.com/ff/ Code from the above <html> <head> <title>FINAL FANTASY XIV - Item Database</title> <style type="text/css"> a:link {text-decoration: none; color: #FFFFFF} a:visited {text-decoration: none; color: #FFFFFF} a:hover {text-decoration: none; color: #FFFFFF} a:active {text-decoration: none; color: #FFFFFF} p.title { font-size: medium; font-family: Verdana; color: #FFFFFF; } p.items { font-size: small; font-family: Verdana; color: #FFFFFF; } </style> <script src="http://static.yg.com/js/exsyndication.js" type="text/javascript"> </script> <script type="text/javascript"> YG.UserSettings.Syndication = { removeClasses: ['extern'], defaultClass: 'yg-iconsmall yg-name', clearTitle: true } </script> </head> <body background="../images/testbg.jpg" marginwidth=60 marginheight=60> <table align="center" id="Table_01" width=520 height=393 border=0 cellpadding=0 cellspacing=0> <tr> <td width=520 height=14 colspan=5 background="../images/test_01.gif"></td> </tr> <tr> <td width=20 height=23 background="../images/test_02.gif"></td> <td colspan=3 background="../images/test_03.gif" align="center" valign="middle"> <p class='title'>FINAL FANTASY XIV - Item Database</p> </td> <td width=14 height=23 background="../images/test_04.gif"></td> </tr> <tr> <td width=520 height=7 colspan=5 background="../images/test_05.gif"></td> </tr> <tr> <td background="../images/test_06.gif"></td> <td colspan=3 background="../images/test_07.gif" align="center" valign="top"> <p class='items'> <?php function grabdata($site){ $page_contents = file_get_contents($site); $pattern = '/\/item\/([a-z,-]+[^gil])\?id\=([0-9,]+)/'; preg_match_all($pattern, $page_contents, $matches); $arrRetList = array(); if(!empty($matches)){ foreach($matches as $item) { foreach($item as $pos => $row){ $arrRetList[$pos][] = $row; } } foreach($arrRetList as $row){ echo "<p class='items'><a href='http://ffxiv.yg.com" . $row[0] . "'>Unknown Item</a> - " . $row[1] . " - " . $row[2] . "<BR>"; } } } grabdata("http://ffxiv.yg.com/items?l=50:50;trd=0;cl=30"); ?> </p> </td> <td background="../images/test_08.gif"></td> </tr> <tr> <td colspan=2 width=23 height=17 background="../images/test_09.gif"></td> <td background="../images/test_10.gif"></td> <td colspan=2 width=17 height=17 background="../images/test_11.gif"></td> </tr> <tr> <td> <img src="../images/spacer.gif" width=20 height=1></td> <td> <img src="../images/spacer.gif" width=3 height=1></td> <td> <img src="../images/spacer.gif" width=480 height=1></td> <td> <img src="../images/spacer.gif" width=3 height=1></td> <td> <img src="../images/spacer.gif" width=14 height=1></td> </tr> </table> </body> </html> Heres the code im trying to run, has some added stuff to the above <?php ?> code but its not viewing at all, just shows a white page.. and would like to get some advice on what im doing wrong <?php function grabdata($site){ $page_contents = file_get_contents($site); $pattern = '/\/item\/([a-z,-]+[^gil])\?id\=([0-9,]+)/'; preg_match_all($pattern, $page_contents, $matches); $arrRetList = array(); if(!empty($matches)){ foreach($matches as $item) { foreach($item as $pos => $row){ $arrRetList[$pos][] = $row; } } foreach($arrRetList as $row){ echo $row[1] . " - " . $row[2] . "<BR>"; echo "<table align='center' border='0' cellpadding='0' cellspacing='0' width='80%'><td align='left'><p class='items'>Item</td><td align='center'><p class='items'>NPC Price</td><tr><td align='left'><p class='items'><a href='http://ffxiv.yg.com" . $row[0] . "'>Unknown Item</a></td></td><td align='center'><p class='items'>"; $page_contents2 = file_get_contents("http://ffxiv.yg.com" . $row[0] . ""); $matches2 = array(); preg_match_all('/<td class=\"lefttd\">Normal<\/td><td align=\"right\">([0-9,]+)<\/td><\/tr>/', $page_contents2, $matches2); if ($matches2[1][0] == ""){ echo "0g - "; } else { print_r($matches2[1][0] . "g - "); } preg_match_all('/<td class=\"lefttd\">\+1<\/td><td align=\"right\">([0-9,]+)<\/td><\/tr>/', $page_contents2, $matches2); if ($matches2[1][0] == ""){ echo "0g - "; } else { print_r($matches2[1][0] . "g - "); } preg_match_all('/<td class=\"lefttd\">\+2<\/td><td align=\"right\">([0-9,]+)<\/td><\/tr>/', $page_contents2, $matches2); if ($matches2[1][0] == ""){ echo "0g - "; } else { print_r($matches2[1][0] . "g - "); } preg_match_all('/<td class=\"lefttd\">\+3<\/td><td align=\"right\">([0-9,]+)<\/td><\/tr>/', $page_contents2, $matches2); if ($matches2[1][0] == ""){ echo "0g"; } else { print_r($matches2[1][0] . "g"); } echo "</td></tr>"; } echo "</table><BR><BR><BR>"; } } grabdata("http://ffxiv.yg.com/items?l=50:50;trd=0;cl=30"); ?> To give you a idea of what im looking for, it already grabs each item and list it from grabdata(""); function, i wanna take that further by it grabs the item, and then uses that data to grab the item sell price (normal, +1, +2, +3 quality) for each display it out, something like.. ITEMNAME1 132g - 145g - 165g - 198g ITEMNAME2 50g - 0g - 0g - 0g ITEMNAME3 63g - 78g - 90g - 110g etc etc from the first $page_contents from $site $row[0] will output: item url variables $row[1] will output: item name $row[2] will output: item # from the second $page_contents from "http://ffxiv.yg.com" . $row[0] . "" $matches2[1][0] will be numerical output of the prices for each preg_match_all These scripts work separately just need them to work together
  6. lol im sorry for these multiple post its not letting me edit any of mine.. but i got it all to work lol just took some tweaking.. heres the code <?php function grabdata($site){ $page_contents = file_get_contents($site); $pattern = '/\/item\/([a-z,-]+[^gil])\?id\=([0-9,]+)/'; preg_match_all($pattern, $page_contents, $matches); $arrRetList = array(); if(!empty($matches)){ foreach($matches as $item) { foreach($item as $pos => $row){ $arrRetList[$pos][] = $row; } //echo $item[0] . " - " . $item[1] . " - " . $item[2] . "<BR>"; } foreach($arrRetList as $row){ //echo implode( " - ", $row ) . "<br />"; echo $row[1] . " - " . $row[2] . "<BR>"; } } } grabdata("http://ffxiv.yg.com/items?f=c=6.2.7"); grabdata("http://ffxiv.yg.com/items?f=c=6.2"); grabdata("http://ffxiv.yg.com/items?f=c=ETC.."); grabdata("http://ffxiv.yg.com/items?f=c=ETC.."); grabdata("http://ffxiv.yg.com/items?f=c=ETC.."); grabdata("http://ffxiv.yg.com/items?f=c=ETC.."); grabdata("http://ffxiv.yg.com/items?f=c=ETC.."); ?>
  7. wow it wont let me modify my last post.. i figured out the second part to make it show just antelope-sinew - 10007504 antelope-sinew-cord - 10007501 carbon-fiber - 10009304 cotton-yarn - 10005302 crawler-cocoon - 10005206 dew-thread - 10005307 diremite-sinew - 10007510 diremite-sinew-cord - 10007509 diremite-web - 10005306 flax - 10005204 hempen-yarn - 10005301 hippogryph-sinew - 10007505 hippogryph-sinew-cord - 10007502 karakul-yarn - 10005305 linen-yarn - 10005303 moko-grass - 10005202 mole-sinew - 10007507 mole-sinew-cord - 10007508 morbol-vine - 10009503 raptor-sinew - 10007506 raptor-sinew-cord - 10007503 straw - 10005201 woolen-yarn - 10005304 I changed foreach($arrRetList as $row){ echo implode( " - ", $row ) . "<br />"; } to foreach($arrRetList as $row){ echo $row[1] . " - " . $row[2] . "<BR>"; } still cant figure out the functions problem :/
  8. Thank you so much it works just like i wanted. Now say i wanted to turn that line of code into a function and call it apon multiple websites something like <?php grabdata("http://ffxiv.yg.com/items?f=c=6.2.7"); grabdata("http://ffxiv.yg.com/items?f=c=7"); grabdata("http://ffxiv.yg.com/items?f=c=5"); grabdata("http://ffxiv.yg.com/items?f=c=etcetc"); function grabdata($site){ $page_contents = file_get_contents($site); $pattern = '/\/item\/([a-z,-]+[^gil])\?id\=([0-9,]+)/'; preg_match_all($pattern, $page_contents, $matches); $arrRetList = array(); if(!empty($matches)){ foreach($matches as $item) { foreach($item as $pos => $row){ $arrRetList[$pos][] = $row; } //echo $item[0] . " - " . $item[1] . " - " . $item[2] . "<BR>"; } foreach($arrRetList as $row){ echo implode( " - ", $row ) . "<br />"; } } } ?> also if i wanted to make /item/antelope-sinew?id=10007504 - antelope-sinew - 10007504 /item/antelope-sinew-cord?id=10007501 - antelope-sinew-cord - 10007501 /item/carbon-fiber?id=10009304 - carbon-fiber - 10009304 /item/cotton-yarn?id=10005302 - cotton-yarn - 10005302 /item/crawler-cocoon?id=10005206 - crawler-cocoon - 10005206 /item/dew-thread?id=10005307 - dew-thread - 10005307 /item/diremite-sinew?id=10007510 - diremite-sinew - 10007510 /item/diremite-sinew-cord?id=10007509 - diremite-sinew-cord - 10007509 /item/diremite-web?id=10005306 - diremite-web - 10005306 /item/flax?id=10005204 - flax - 10005204 /item/hempen-yarn?id=10005301 - hempen-yarn - 10005301 /item/hippogryph-sinew?id=10007505 - hippogryph-sinew - 10007505 /item/hippogryph-sinew-cord?id=10007502 - hippogryph-sinew-cord - 10007502 /item/karakul-yarn?id=10005305 - karakul-yarn - 10005305 /item/linen-yarn?id=10005303 - linen-yarn - 10005303 /item/moko-grass?id=10005202 - moko-grass - 10005202 /item/mole-sinew?id=10007507 - mole-sinew - 10007507 /item/mole-sinew-cord?id=10007508 - mole-sinew-cord - 10007508 /item/morbol-vine?id=10009503 - morbol-vine - 10009503 /item/raptor-sinew?id=10007506 - raptor-sinew - 10007506 /item/raptor-sinew-cord?id=10007503 - raptor-sinew-cord - 10007503 /item/straw?id=10005201 - straw - 10005201 /item/woolen-yarn?id=10005304 - woolen-yarn - 10005304 only show: antelope-sinew - 10007504 antelope-sinew-cord - 10007501 carbon-fiber - 10009304 cotton-yarn - 10005302 crawler-cocoon - 10005206 dew-thread - 10005307 diremite-sinew - 10007510 diremite-sinew-cord - 10007509 diremite-web - 10005306 flax - 10005204 hempen-yarn - 10005301 hippogryph-sinew - 10007505 hippogryph-sinew-cord - 10007502 karakul-yarn - 10005305 linen-yarn - 10005303 moko-grass - 10005202 mole-sinew - 10007507 mole-sinew-cord - 10007508 morbol-vine - 10009503 raptor-sinew - 10007506 raptor-sinew-cord - 10007503 straw - 10005201 woolen-yarn - 10005304 :confused:
  9. What im trying to do is grab a list of items from http://ffxiv.yg.com/items?f=c=6.2.7 and display it for me in a blank layout like /item/antelope-sinew-cord?id=10007501 - antelope-sinew-cord - 10007501 /item/carbon-fiber?id=10009304 - carbon-fiber - 10009304 etc etc.. But the code i came up with grabs the data great.. (TOOK ME FOREVER TO FIGURE OUT THE PATTERN ) but i finally managed to get it lol.. anyways the following code is <?php $page_contents = file_get_contents("http://ffxiv.yg.com/items?f=c=6.2.7"); $pattern = '/\/item\/([a-z,-]+[^gil])\?id\=([0-9,]+)/'; $matches = array(); preg_match_all($pattern, $page_contents, $matches); foreach($matches as $item) { echo $item[0] . " - " . $item[1] . " - " . $item[2] . "<BR>"; } ?> It works but not the way im looking.. it gives me data like so /item/antelope-sinew?id=10007504 - /item/antelope-sinew-cord?id=10007501 - /item/carbon-fiber?id=10009304 antelope-sinew - antelope-sinew-cord - carbon-fiber 10007504 - 10007501 - 10009304 Thanks for whomever to take a look, and thanks for your responses
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.