Jump to content

Search the Community

Showing results for tags 'parse'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (Dreamweaver, Zend, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start





Website URL








Donation Link

Found 16 results

  1. Can someone please help me? i cant quite figure out how to parse out the following json data: {"data":[{"id":2464,"vehiclemodel_id":969,"vehicleyear_id":39,"created_at":"2016-10-10 14:51:02","updated_at":"2016-10-10 14:51:02","attributevalues":{"data":[]},"items":{"data":[{"id":389,"brand_id":406,"country_id":227,"product_id":6,"sku":"015-01003","name":"MULTIRATE FORK SPRINGS 41MM","list_price":"126.95","standard_dealer_price":"88.99","supplier_product_id":"FS-1028","length":24.5,"width":4.7,"height":1.9,"weight":3.42,"upc":null,"superseded_sku":null,"status_id":"STK","status":"STK","unit_of_measurement_id":null,"has_map_policy":false,"sort":0,"created_at":"2016-06-17 20:47:51","updated_at":"2022-01-03 17:39:04","published_at":"2016-06-17 20:47:51","images":{"data":[{"id":94477,"domain":"cdn.wpsstatic.com\/","path":"images\/","filename":"88ff-5b02f15f8c0b7.jpg","alt":null,"mime":"image\/jpeg","width":5419,"height":3473,"size":6496067,"signature":"2f99154396b9412e1a0db1c10f29fdf1fc989f9db8236efdb28d52341a445405","created_at":"2018-05-21 16:18:46","updated_at":"2018-05-21 16:18:46"}]}},{"id":394,"brand_id":406,"country_id":227,"product_id":263235,"sku":"015-01012","name":"LOWERING FORK SPRINGS 41MM","list_price":"139.95","standard_dealer_price":"98.99","supplier_product_id":"LK-2011","length":24.5,"width":4.5,"height":1.7,"weight":3.43,"upc":null,"superseded_sku":null,"status_id":"STK","status":"STK","unit_of_measurement_id":null,"has_map_policy":false,"sort":0,"created_at":"2016-06-17 20:47:51","updated_at":"2022-01-03 17:39:05","published_at":"2016-06-17 20:47:51","images":{"data":[{"id":174,"domain":"cdn.wpsstatic.com\/","path":"images\/","filename":"becb-572a4ec444772.jpg","alt":null,"mime":"image\/jpeg","width":1000,"height":447,"size":138779,"signature":"dc570b1218a024f1acf9dd4b39fc6e7ea2a12d64fae46622e2a25d85e31d8d76","created_at":"2016-05-04 19:34:28","updated_at":"2017-02-23 18:01:01"}]}},{"id":634992,"brand_id":434,"country_id":227,"product_id":185661,"sku":"810-0607","name":"BRAKE PEDAL COVER TOURING BAD AXE BLACK","list_price":"99.00","standard_dealer_price":"69.30","supplier_product_id":"BAX-340-BLK","length":7,"width":5,"height":1,"weight":1,"upc":null,"superseded_sku":null,"status_id":"NEW","status":"NEW","unit_of_measurement_id":12,"has_map_policy":true,"sort":0,"created_at":"2022-04-13 07:53:11","updated_at":"2022-05-16 07:31:54","published_at":"2022-05-16 07:31:54","images":{"data":[]}}]},"vehiclemodel":{"data":{"id":969,"vehiclemake_id":22,"db2_key":"193","name":"FLSTF Softail Fat Boy","created_at":"2016-10-10 14:47:50","updated_at":"2018-04-11 17:43:23","vehiclemake":{"data":{"id":22,"db2_key":"HARLEY","name":"Harley-Davidson","created_at":"2016-10-10 14:47:14","updated_at":"2021-12-22 17:44:31"}}}},"vehicleyear":{"data":{"id":39,"name":1993,"created_at":"2016-10-10 14:50:07","updated_at":"2016-10-10 14:50:07"}}}],"meta":{"cursor":{"current":"61poYD9eaDkR","prev":null,"next":null,"count":1}}} here is where it is also layed out differently: { "data": [ { "id": 2464, "vehiclemodel_id": 969, "vehicleyear_id": 39, "created_at": "2016-10-10 14:51:02", "updated_at": "2016-10-10 14:51:02", "attributevalues": { "data": [] }, "items": { "data": [ { "id": 389, "brand_id": 406, "country_id": 227, "product_id": 6, "sku": "015-01003", "name": "MULTIRATE FORK SPRINGS 41MM", "list_price": "126.95", "standard_dealer_price": "88.99", "supplier_product_id": "FS-1028", "length": 24.5, "width": 4.7, "height": 1.9, "weight": 3.42, "upc": null, "superseded_sku": null, "status_id": "STK", "status": "STK", "unit_of_measurement_id": null, "has_map_policy": false, "sort": 0, "created_at": "2016-06-17 20:47:51", "updated_at": "2022-01-03 17:39:04", "published_at": "2016-06-17 20:47:51", "images": { "data": [ { "id": 94477, "domain": "cdn.wpsstatic.com/", "path": "images/", "filename": "88ff-5b02f15f8c0b7.jpg", "alt": null, "mime": "image/jpeg", "width": 5419, "height": 3473, "size": 6496067, "signature": "2f99154396b9412e1a0db1c10f29fdf1fc989f9db8236efdb28d52341a445405", "created_at": "2018-05-21 16:18:46", "updated_at": "2018-05-21 16:18:46" } ] } }, { "id": 394, "brand_id": 406, "country_id": 227, "product_id": 263235, "sku": "015-01012", "name": "LOWERING FORK SPRINGS 41MM", "list_price": "139.95", "standard_dealer_price": "98.99", "supplier_product_id": "LK-2011", "length": 24.5, "width": 4.5, "height": 1.7, "weight": 3.43, "upc": null, "superseded_sku": null, "status_id": "STK", "status": "STK", "unit_of_measurement_id": null, "has_map_policy": false, "sort": 0, "created_at": "2016-06-17 20:47:51", "updated_at": "2022-01-03 17:39:05", "published_at": "2016-06-17 20:47:51", "images": { "data": [ { "id": 174, "domain": "cdn.wpsstatic.com/", "path": "images/", "filename": "becb-572a4ec444772.jpg", "alt": null, "mime": "image/jpeg", "width": 1000, "height": 447, "size": 138779, "signature": "dc570b1218a024f1acf9dd4b39fc6e7ea2a12d64fae46622e2a25d85e31d8d76", "created_at": "2016-05-04 19:34:28", "updated_at": "2017-02-23 18:01:01" } ] } }, { "id": 634992, "brand_id": 434, "country_id": 227, "product_id": 185661, "sku": "810-0607", "name": "BRAKE PEDAL COVER TOURING BAD AXE BLACK", "list_price": "99.00", "standard_dealer_price": "69.30", "supplier_product_id": "BAX-340-BLK", "length": 7, "width": 5, "height": 1, "weight": 1, "upc": null, "superseded_sku": null, "status_id": "NEW", "status": "NEW", "unit_of_measurement_id": 12, "has_map_policy": true, "sort": 0, "created_at": "2022-04-13 07:53:11", "updated_at": "2022-05-16 07:31:54", "published_at": "2022-05-16 07:31:54", "images": { "data": [] } } ] }, "vehiclemodel": { "data": { "id": 969, "vehiclemake_id": 22, "db2_key": "193", "name": "FLSTF Softail Fat Boy", "created_at": "2016-10-10 14:47:50", "updated_at": "2018-04-11 17:43:23", "vehiclemake": { "data": { "id": 22, "db2_key": "HARLEY", "name": "Harley-Davidson", "created_at": "2016-10-10 14:47:14", "updated_at": "2021-12-22 17:44:31" } } } }, "vehicleyear": { "data": { "id": 39, "name": 1993, "created_at": "2016-10-10 14:50:07", "updated_at": "2016-10-10 14:50:07" } } } ], "meta": { "cursor": { "current": "61poYD9eaDkR", "prev": null, "next": null, "count": 1 } } } i can get the id 2464 but i cant get data under items -> data -> id (389) , or images data -> filename or list_price ect.. please help
  2. Greetings, I'm not 100% sure if this is a server problem so I apologize if this ends up in the wrong thread. So I moved websites from an old server to a new one and everything is working perfectly with the exception of parsing PHP in an HTML file. for instance the following will only work if its in a .php file not an html, otherwise it just pushes the <?php echo "hello world"; ?> ..which tells me that PHP is on and working, but not parsing HTML. I googled and read as much as I could on here about this, and the only thing that I can find is alterations to the .htaccess file to make this work. I already had a .htaccess file, but maybe now it need altering? I currently have (and it looks messy) this... which worked on my old server and I am assuming old PHP software. I am currently running PHP Version 5.5.20. A snippet from my .htaccess AddType application/x-httpd-php php html AddType application/x-httpd-php .html AddType application/x-httpd-php .htm <Files yourpage.html> AddType application/x-httpd-php .htm I have found a bunch of alterations to this online, but nothing appears to work so I thought I would ask the experts. Again PHP seems to work, but only if the extension is .php which I do not want in this situation. Thanks for any help!
  3. Hello, I have a very big problem with stolen data and i don't know how to STOP that. The situation : I have a website where i spend lot of time to register events and info on events (something like www.CoolEvents.com) Users can log in and then comment events, and do others actions when logged. The PROBLEM : Someone created AN IPHONE APPLICATION that is an EXACT copy of my website, and is name CoolEvent App !!! Same infos, same comments, and you can log in via this app (parsing my site) and post comment on my website ! It's horrible for me, because 40% of my users now used this application (who earn money by displaying advertising). So i losed 40% of visitors !!! Without using legal channels, how can i STOP an IPHONE APP to parse my website or to acces to my website ? Do you know a TECHNICAL solution to prevent an APP to PARSE and then copy my website ? At least, is it possible to made it IMPOSSIBLE to log in to my website (and so be able to post comment on my site) by using this APP ? Thanks for your help !!
  4. Hello ! I'm new on this board and I need your help ! I explain you my problem. I'd like to collect the content of around 1000 URL in a textfile (I use the wget function in a bash). And then I want to parse this textfile in order to pick one type of content up in a csv file. 1) So my bash is this one : file=/home/julien/tests/file.txt for i in $(cat $file) do wget $i -O ->> songs_t.txt; done It works perfectly and the textfile songs_t.txt is well created. That textfile contains the content of the 1000 URLs. 2) Then I make a php script to parse songs_t.txt. I only want to get concert setlists (the setlist is only a part of a the content of each URL). So my approach is to remove tags such as 'a', 'h4', 'Title' and so on and save the rest in a csv file called 'SONGS.csv' An example of a URL can be seen here : http://members.tripod.com/~fun_fun_fun/8-17-63.html My part of the php script dealing with the parsing is this one : $html = file_get_html('songs_t.txt'); foreach ($html->find('title, script, div, center, style, img, noscript, h4, a') as $es) $es->outertext = 'title, script, div, center, style, img, noscript, h4, a'; $f = fopen('SONGS.csv', "w"); fwrite ($f, $html); fclose($f); The script works for the 35 first URL (I nearly only get the setlists) but as soon as the script has to deal with more than 35 URL, I have the following error message : Call to a member function find() on a non-object in /home/julien/tests/boys2.php on line 23. That line 23 corresponds to : foreach ($html->find('title, script, div, center, style, img, noscript, h4, a') as $es) 3) In order to test if my html object is valid, I use that code : html = file_get_html('songs_t.txt'); if (!is_object($html)){ echo "invalid object"; } And the result is "invalid object". This test is made in a textfile composed of the content of 50 URL. But when I apply that test on textfile composed of 30 URL, I have no error ! So how can I do to parse my HTML even if it's not a entire valid object ? Could you help me please ? Thanks !
  5. Think there's some prase error here, but i can't figure out what is wrong. anyone? if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) { $insertSQL = sprintf("INSERT INTO kommentar (tittel, navn, tekst, tidsstempel, innleggid) VALUES ( %s, %s, %s, NOW(), %s)' GetSQLValueString($_POST['tittel'], "text"), GetSQLValueString($_POST['navn'], "text"), GetSQLValueString($_POST['tekst'], "text"), GetSQLValueString($_GET['innleggid'], "int") ); mysql_select_db($database_bloggkobling, $bloggkobling); $Result1 = mysql_query($insertSQL, $bloggkobling) or die(mysql_error()); } Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in C:\wamp\www\bloggprosjekt\visinnlegg.php on line 50
  6. I am only a few months into PHP and don't grasp all the things that i guess the "expert" programmers do, so for that i'm sorry... i'm working on it. I need help with what code would accomplish what i need below, I have had only partial success but am now stuck. I have used CURL to post to a remote site form and return the results, the returned results is the full raw HTML of that forms results page. There is only 1 table of data i need from the entire page and the only unique identifier of the table is a unique CLASS attribute. I have been able, through trial and error to get the initial stage of assigning the HTML response to a PHP DOM object and identify the needed table by its class assignment using an example found on the net. But: 1.) I really am having a hard time understand the whole DOM object models and manipulation. 2.) The code below, returns the TABLE i need, but all HTML is stripped form it, thus i just get one long running line of text. I need that table and its content, html tags and all assigned to a variable. Please help. Example: ^^^^^^ Lots of misc HTML code above ^^^^^^ <table class="magicname" height=100 width=100> <tr> <td> <p>whatever content is in here </p> </td> </tr> <tr> <td> <p>whatever content is in here </p> </td> </tr> </table> vvvvv Lots of misc HTML code below vvvv My Current code: $classname = 'maintbl'; $dom = new DOMDocument; $dom->loadHTML($server_output); $xpath = new DOMXPath($dom); $results = $xpath->query("//*[@class=" . $classname . "]"); foreach($results as $node) { echo "{$node->nodeName} - {$node->nodeValue}<br>"; // or you can just print out the the XML: // $dom->saveXML($node);
  7. I'm trying to query sql to post all new users on my site to the index page. This string: $sql = "SELECT COUNT(id) FROM users WHERE activated='1'"; keeps returning this error: Parse error: syntax error, unexpected T_LNUMBER in /home/******/********/index.php on line 14 I have tried canceling out as suggested on php.net using: $sql = SELECT COUNT(id) FROM users WHERE activated=\'1'; and receive: Parse error: syntax error, unexpected $end in /home/******/********/index.php on line 35 because now it's incomplete. What's the issue? All suggestions I have found online are not working.
  8. Hello everyone , I'd like to know if there is some not too hard way to read/parse basic informations in a local file D:/Outlook/outlook.pst. I've check some imap informations such as http://uk3.php.net/manual/en/book.imap.php but I didn't find some easy way to get an email for example or i didn't get how to do it. They talk about imap_open opening local server... But how about a pst file? I guess after parsing won't be easy because .pst file might be not txt file... But do someone has also a clue... Thanks for help. Doctor_No7. www.desgensbien.com
  9. Hi, I am new to PHP.So any help would be great. I would like to display a drop down list and a textbox on a page. This dropdown data will be populated from a textbox. What I would like to know is, how to: parse a file and extact some data from a txt file which is on a server. populate this dropdown on the page with the data also I would like to display another data on the textbox according to the data selected on the drop down list and of couse how to test this script etc. Best Regards.
  10. Hi Guys i am getting the following error when trying to install a theme in my wordpress. "Parse error: syntax error, unexpected '}' in /home/partypor/rightawayprinting.com/wp-content/themes/daisho/framework/admin/background-menu.php on line 1" This is the code for the background-menu.php. Can someone please help me find whats wrong. Thanks! <?php add_action( 'admin_init', 'backgroundmenuregs' ); add_action( 'wp_head', 'add_bg_changerstyle' ); function backgroundmenuregs(){ wp_enqueue_script('jquery'); wp_register_style( 'FlowTypographyMainStylesheet', WP_PLUGIN_URL . '/typography/js/colorpicker/css/colorpicker.css' ); wp_register_style( 'FlowTypographyLayoutStylesheet', WP_PLUGIN_URL . '/typography/js/colorpicker/css/layout.css' ); wp_register_script('jquery_colorpicker_script', WP_PLUGIN_URL . '/typography/js/colorpicker/js/colorpicker.js', array('jquery'), '1.0' ); wp_enqueue_style( 'FlowTypographyMainStylesheet' ); wp_enqueue_style( 'FlowTypographyLayoutStylesheet' ); wp_enqueue_script('jquery_colorpicker_script'); } function add_bg_menu(){ //must check that the user has the required capability if (!current_user_can('manage_options')) { wp_die( __('You do not have sufficient permissions to access this page.') ); } echo '<div class="wrap">'; echo "<h2>" . __( 'Styling', 'menu-test' ) . "</h2>"; if($_POST['bg_submit_h'] && $_POST['bg_submit_h'] == "Y"){ $bgrepeat = array("repeat"=>"repeat","repeatx"=>"repeat-x","repeaty"=>"repeat-y","norepeat"=>"no-repeat"); update_option("bgchanger_color", $_POST['bc']); update_option("bgchanger_imgsrc", $_POST['bi']); if($_POST['bpx'] == "left" || $_POST['bpx'] == "center" || $_POST['bpx'] == "right"){ update_option("bgchanger_posx", $_POST['bpx']); } if($_POST['bpy'] == "top" || $_POST['bpy'] == "center" || $_POST['bpy'] == "bottom"){ update_option("bgchanger_posy", $_POST['bpy']); } if($_POST['ba'] == "fixed" || $_POST['ba'] == "scroll"){ update_option("bgchanger_attach", $_POST['ba']); } if(array_key_exists($_POST['br'], $bgrepeat)){ update_option("bgchanger_repeat", $bgrepeat[$_POST['br']]); } ?> <div class="updated"><p><strong><?php _e('settings saved.', 'menu-test' ); ?></strong></p></div> <?php } $bgcval_bc = get_option("bgchanger_color"); $bgcval_bi = get_option("bgchanger_imgsrc"); $bgcval_bpx = get_option("bgchanger_posx"); $bgcval_bpy = get_option("bgchanger_posy"); $bgcval_ba = get_option("bgchanger_attach"); $bgcval_br = get_option("bgchanger_repeat"); ?> <script type="text/javascript">jQuery(document).ready(function(){jQuery(".attcolorpicker").each(function(){jQuery(this).ColorPicker({onShow:function(cp){jQuery(cp).fadeIn(500);return false;},onHide:function(cp){jQuery(cp).fadeOut(500);return false;},onChange:function(hsb, hex, rgb){jQuery(this).parent().find('.attcolorpicker').val('#'+hex);jQuery(this).parent().find('.colorSelector div').css('backgroundColor', '#'+hex);jQuery(this).parent().find('.colorSelector').ColorPickerSetColor(hex);}});jQuery(this).parent().find('.colorSelector').ColorPicker({onShow:function(cp){jQuery(cp).fadeIn(500);return false;},onHide:function(cp){jQuery(cp).fadeOut(500);return false;},onChange:function(hsb, hex, rgb){jQuery(this).parent().find('.attcolorpicker').val('#'+hex);jQuery(this).parent().find('.colorSelector div').css('backgroundColor', '#'+hex);jQuery(this).parent().find('.attcolorpicker').ColorPickerSetColor(hex);}});});});</script> <form method="post" action=""> <table class="form-table"> <tr><th>Background color</th><td> <input type="text" class="attcolorpicker" name="bc" value="<?php if($bgcval_bc) print($bgcval_bc); ?>"> <div class="colorSelector"><div<?php if($bgcval_bc) print(" style=\"background-color:".$bgcval_bc.";\""); ?>></div></div> </td></tr> <tr><th>Background image</th><td><input type="text" name="bi" value="<?php if($bgcval_bi) print($bgcval_bi); ?>"><span href="#" title="" class="briskuploader button">Upload</span><br/><div class="briskuploader_preview"></div></td></tr> <tr><th>Background position</th><td><select name="bpx"><option value="left"<?php if($bgcval_bpx=="left") print(" selected=\"selected\""); ?>>left</option><option value="center"<?php if($bgcval_bpx=="center") print(" selected=\"selected\""); ?>>center</option><option value="right"<?php if($bgcval_bpx=="right") print(" selected=\"selected\""); ?>>right</option></select><select name="bpy"><option value="top"<?php if($bgcval_bpy=="top") print(" selected=\"selected\""); ?>>top</option><option value="center"<?php if($bgcval_bpy=="center") print(" selected=\"selected\""); ?>>center</option><option value="bottom"<?php if($bgcval_bpy=="bottom") print(" selected=\"selected\""); ?>>bottom</option></select></td></tr> <tr><th>Background attachment</th><td><select name="ba"><option value="scroll"<?php if($bgcval_ba=="scroll") print(" selected=\"selected\""); ?>>Scroll</option><option value="fixed"<?php if($bgcval_ba=="fixed") print(" selected=\"selected\""); ?>>Fixed</option></select></td></tr> <tr><th>Background repeat</th><td><select name="br"><option value="repeat"<?php if($bgcval_br=="repeat") print(" selected=\"selected\""); ?>>repeat</option><option value="repeatx"<?php if($bgcval_br=="repeat-x") print(" selected=\"selected\""); ?>>repeat-x</option><option value="repeaty"<?php if($bgcval_br=="repeat-y") print(" selected=\"selected\""); ?>>repeat-y</option><option value="norepeat"<?php if($bgcval_br=="no-repeat") print(" selected=\"selected\""); ?>>no-repeat</option></td></tr> </table> <p class="submit"> <input type="hidden" name="bg_submit_h" value="Y"> <input type="submit" name="Submit" class="button-primary" value="<?php esc_attr_e('Save Changes') ?>" /> </p> </form> </div> <?php } function add_bg_changerstyle(){ $bgcval_bc = get_option("bgchanger_color"); $bgcval_bi = get_option("bgchanger_imgsrc"); if($bgcval_bc || $bgcval_bi){ print("<style type=\"text/css\"> body{ "); if($bgcval_bc){ print("background-color:".$bgcval_bc.";"); } if($bgcval_bi){ if($bgcval_bi == "none"){ print("background-image:none;"); }else{ print("background-image:url(".$bgcval_bi.");"); $bgcval_bpx = get_option("bgchanger_posx"); $bgcval_bpy = get_option("bgchanger_posy"); $bgcval_ba = get_option("bgchanger_attach"); $bgcval_br = get_option("bgchanger_repeat"); if($bgcval_bpx == "left" || $bgcval_bpx == "center" || $bgcval_bpx == "right"){ if($bgcval_bpy == "top" || $bgcval_bpy == "center" || $bgcval_bpy == "bottom"){ print("background-position:".$bgcval_bpx." ".$bgcval_bpy.";"); } } if($bgcval_ba == "fixed" || $bgcval_ba == "scroll"){ print("background-attachment:".$bgcval_ba.";"); } if($bgcval_br == "repeat" || $bgcval_br == "repeat-x" || $bgcval_br == "repeat-y" || $bgcval_br == "no-repeat"){ print("background-repeat:".$bgcval_br.";"); } } } print(" } </style>"); } } ?>
  11. Hello all, This is my very first post here and I hope someone could help me out on this as it has been a labour intensive time to try and learn all about this coding. I am trying to learn this coding using PHP and trying to do stuff myself and just through a lot of research.......I have found the holy grail of all XML feeds and this was the one feed that people who look to the main steam rankings for. Ok so I am very excited to share this with you guys and show you what I have done based on how you have educated me so far, please bear with me here: Ok the XML feed (the holy grail) is the GLOBAL USER RANKINGS, there is only one site using it now: www.aoe2stats.com They are doing what I a trying to achieve and I think I am 95% there based on what you guys have taught me through the coding, ok so here it is, I hope I still have peoples attention here. here is the link to the XML FEED: http://steamcommunity.com/stats/AgeofEmpiresIIHDEdition/leaderboards/131879/?xml=1 Ok, this information I am trying to extract is the following: http://steamcommunity.com/stats/Ageo...l=1&start=5001 ]]> </nextRequestURL> <resultCount>5000</resultCount> <entries> <entry> <steamid>76561198032048763</steamid> <score>689</score> <rank>1</rank> <ugcid>-1</ugcid> <details> <![CDATA[ ]]> </details> </entry> <entry> <steamid>76561198011427258</steamid> <score>632</score> <rank>2</rank> <ugcid>-1</ugcid> <details> <![CDATA[ ]]> ___________________________________________________ Into a table with 4 columns, with the names on each column: Steam Name - Score - Rank - Ugcid Now this is where I am learning also, I need to parse the (steamid) into the (community id) the steam id is the long number above and the community id is username on steam: website to show example: steamidfinder.com ok I have found a script to parse the <steamid>76561198032048763</steamid> into the person name: Huehnerbein as an example above, so I have been doing a lot of reaearching and I have found the following: _____________________________________________________________ Assuming that your input steam_id is $INPUT and your final output array is stored in $OUTPUT, this is the functional for each approach that you could use to convert steam_id to personaname: /** * Convert steam_id to personaname * @returns STRING The name associated with the given steam_id * BOOL FALSE if no match was found */ function steamID_to_name($INPUT, $OUTPUT) { // This gets the relevant part of the API response. $array = $OUTPUT['response']['players']; // Using your function to convert `steam_id` to a community ID $community_id = SteamID2CommunityID($INPUT); // Linear search foreach ($array as $array_item) { // If a match was found... if ($community_id == $array_item['steamid']) // Return the name return $array_item['personaname']; } // If no match was found, return FALSE. return false; } _________________________________________________________________ So the conclusion is the script below, unfortunately is does not work but I have tried to change the neccesary parameters in the script, so the objective is: as what www.aoe2stats.com are the only ones who have done it!! To have the 4 entries in a 4 column table: Steam Name - Score - Rank - Ugcid and to have the steamid parse into the community_id or username. OK THE ACTUAL SCRIPT I HAVE MODIFIED, IT DOES NOT WORK BUT CAN YOU GUYS SHARE WITH ME WHAT MISTAKES I HAVE MADE SO I CAN GET THIS HOLY GRAIL SCRIPT WORKING, I HAVE SPENT HOURS ON THIS: SCRIPT BELOW: ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ <?php header("Cache-Control: no-cache, must-revalidate"); header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); $sFeed = 'http://steamcommunity.com/stats/AgeofEmpiresIIHDEdition/leaderboards/131879/?xml=1' . microtime(true); /** * Convert steam_id to personaname * @returns STRING The name associated with the given steam_id * BOOL FALSE if no match was found */ function steamID_to_name($INPUT, $OUTPUT) { // This gets the relevant part of the API response. $array = $OUTPUT['response']['players']; // Using your function to convert `steam_id` to a community ID $community_id = SteamID2CommunityID($INPUT); // Linear search foreach ($array as $array_item) { // If a match was found... if ($community_id == $array_item['steamid']) // Return the name return $array_item['personaname']; } // If no match was found, return FALSE. return false; } $dom = new DOMDocument('1.0', 'utf-8'); $dom->load($sFeed); $steamid = $dom->getElementsByTagName('steamid'); if ($entry->length > 0) $score = $dom->getElementsByTagName('score'); if ($entry->length > 0) $rank = $dom->getElementsByTagName('rank'); if ($entry->length > 0) $ugcid = $dom->getElementsByTagName('ugcid'); if ($entry->length > 0) { ?> <style> table, td, th body { font-family:Verdana, Arial, Helvetica; font-size: 81%; margin: 0px; color: #5c3d0b; font-weight:bold; } { border:1px solid black; } th { background-color:e6cb9c; } </style> <table border="1"> <tr> <th>NAME</th> <th>SCORE</th> <th>RANK</th> <th>UGCID</th> </tr> <? foreach ($entry AS $entry) { $steamid = $entry->getElementsByTagName('steamid')->item(0)->nodeValue; $score = $entry->getElementsByTagName('score')->item(0)->nodeValue; $rank = $entry->getElementsByTagName('rank')->item(0)->nodeValue; $ugcid = $entry->getElementsByTagName('ugcid')->item(0)->nodeValue; printf("<tr><td>%s</td><td>%s</td></tr>" . PHP_EOL, $name, $percent); } print('</table>'); } ___________________________________________________________________ OK PLEASE PLEASE GUYS WOULD LOVE TO SEE WHAT I HAVE DONE WRONG TO GET THIS SCRIPT WORKING SO MANY THANKS!!
  12. How to parse third party website data to my database. <table width='220' id='tbllist'><caption><span id='class1' >MAGNUM</span></caption><tr><th>First</th><th>Second</th><th>Thrid</th></tr><tr><td align='center'><b>1935</b></td><td align='center'><b>8019</b></td><td align='center'><b>0842</b></td></tr><tr><td colspan='3' align='center'><div>Sepcial</div> <b> 2129 </b> <b> 1121 </b> <b> 0001 </b> <b> 8457 </b> <b> 3064 </b> <b> 3974 </b> <b> 7222 </b> <b> 4612 </b> <b> 1625 </b> <b> 3245 </b> </td></tr><tr><td colspan='3' align='center'><div>Others</div> <b> 9048 </b> <b> 0393 </b> <b> 7221 </b> <b> 8464 </b> <b> 0076 </b> <b> 4124 </b> <b> 2222 </b> <b> 9272 </b> <b> 2088 </b> <b> 4517 </b> </td></tr></table>
  13. This is an example of my code: $status = $entry->title; echo substr(strstr($status," "), 1) . substr($status, 0, -18); Below is the outcome: I'm feeling cold in this room. #emotionalclothingPants: I'm feeling cold in this room. I want the oucome to look like this: I'm feeling cold in this room. Thus removing the "#emotionalclothing" part of the string How can this be achieved? Thanks Stuart
  14. At present I have wrote the code below to parse Twitter hashtags "#emotionalclothing". What I really want to do is parse hashtags or status updates with any instance of the phase "emotionalclothing". So say there's a word that reads "blahemotionalclothingblah" in a status update how could retrieve that status update just by searching for a regex with "emotionalclothing" in it? Here's my code so far: Thanks Stuart <?php $pagetitle = "Pull Twitter Hashtags"; function getTweets($hash_tag) { $url = 'http://search.twitter.com/search.atom?q='.urlencode($hash_tag) ; echo "<p>Connecting to <strong>$url</strong> ...</p>"; $ch = curl_init($url); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, TRUE); $xml = curl_exec ($ch); curl_close ($ch); //If you want to see the response from Twitter, uncomment this next part out: //echo "<p>Response:</p>"; //echo "<pre>".htmlspecialchars($xml)."</pre>"; $affected = 0; $twelement = new SimpleXMLElement($xml); foreach ($twelement->entry as $entry) { $text = trim($entry->title); $author = trim($entry->author->name); $time = strtotime($entry->published); $id = $entry->id; echo "<p>Tweet from ".$author.": <strong>".$text."</strong> <em>Posted ".date('n/j/y g:i a',$time)."</em></p>"; } return true ; } getTweets('#emotionalclothing'); ?>
  15. Hi Chaps, I have been given an invalid XML file, which when run through 3rd party software, gives me the line & column numbers of the error. Instead of opening the file and manually searching for the line/column numbers (which can take a whie, as the file is vast!), is there a way to parse the XML file and locate the error, using the line/column numbers? And maybe display/highlight the error in a browser? e.g.: 1: open bad-file.xml 2: read bad-file.xml 3. go-to line 50 4. go-to column 3620 5. open in browser 6. highlight error Cheers S
  16. Hi, I am fairly new to PHP and I can't for the life of me correct this error: "Parse error: syntax error, unexpected '$username' (T_VARIABLE) in D:\Computer Forensics\xampp\htdocs\xampp\iis\php\userprofile.php on line 7" Here is the corrosponding file code: <?php include 'connection.php'; ?> <?php $username = $_SESSION['authenticatedUser']; $query = 'SELECT firstname, surname, username, password, email, address1, address2, postcode FROM customers WHERE username='$username' LIMIT 1'; $result = mysql_query($query); while($row = mysql_fetch_assoc($result)) { $username = $row['username']; } ?> <html> <table border=1> <tr> <th>Username</th><td><input type="text" name="username" value="<?php echo $_SESSION["authenticatedUser"] ?>" /></td> </tr> </table> </html> I have tried using the $_SESSION variable instead of $username and alternated the quotation marks etc but it still has no affect. It would be much appreciated if anyone could help me out. Thanks, Sam.
  • 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.