Search the Community
Showing results for tags 'parse'.
-
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
-
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!
-
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 !!
-
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 !
-
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
-
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);