Jump to content

Search the Community

Showing results for tags 'xml'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • 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 (PhpStorm, VS Code, 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

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

  1. I need some help to understand the validation of xPath expression in PHP. I want to validate if a xPath expression is correct before i pass it to DOMXPath::query.
  2. I would like to get Type, Id and Height values in database table. It is not working. There is no error message. XML File: <?xml version="1.0" encoding="utf-8"?> <Physical> <Catalog> <EquipmentSpec> <Reference>030_17</Reference> <Type>Duplexeur</Type> <Characteristic><CharacteristicName>Tilt</CharacteristicName> <CharacteristicValue>0</CharacteristicValue></Characteristic> </EquipmentSpec> <EquipmentSpec> <Reference>030_19</Reference> <Type>Node</Type> <Characteristic><CharacteristicName>Tilt</CharacteristicName> <CharacteristicValue>0</CharacteristicValue></Characteristic> </EquipmentSpec> </Catalog> <Installed> <Equipment> <Id>26</Id><Reference>MAT_4</Reference> <Characteristic><CharacteristicName>Height</CharacteristicName><CharacteristicValue>160</CharacteristicValue></Characteristic> </Equipment> <Equipment> <Id>27</Id><Reference>MAT_6890</Reference> <Characteristic><CharacteristicName>Height</CharacteristicName><CharacteristicValue>180</CharacteristicValue></Characteristic> </Equipment> </Installed> </Physical> CODE: foreach ($xml->xpath('Physical') as $spec) { foreach ($spec->xpath('//EquipmentSpec') as $sub) { $Type = $sub->Type; } foreach ($spec->xpath('//Equipment') as $eq) { $Id = $eq->Id; foreach ($eq->Characteristic as $c) { if ($c->CharacteristicName == 'Height') { $Height = $c->CharacteristicValue; } } } $sql = "INSERT INTO machines (`Type`,`Id`,`Height`) VALUES ('".$Type."','".$Id."','".$Height."')"; $req = new requete($site->db, $sql); echo $sql; }
  3. Hello, I would like to know how i can develop interface between XML and MDB files? Actually, i need to convert files from XML into MDB and vice versa. Approximately, how much time it will take?
  4. Hey, I'm trying to pass get variables through an https ssl secured url to generate xml data so I can parse it and I'm not sure how to get it working. I have the following code, I have the url set up like this, $xml = ' weight_system="IMPERIAL" shipper_number="000222000" destination_postal_code="'.$data5['zip'].'" service_type="1" '; $xml2 = ' total_pieces="'.$value.'" total_weight="'.$weight.'" '; $token = 'token'; $base_url = 'https://www.shippingco.com/XML/RatingXML.jsp'; $request_url = $base_url . '?' . http_build_query(array( 'shipment' => '<shipment ' . $xml . '><total ' . $xml2 . '/></shipment>', 'token' => $token )); and I have an example of the xml data here, <rating xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.shippingco.com/XML/rating.xsd"> <rate weight="5.0" weight_unit="lb" zone="3" transit_time="1" transit_time_guaranteed="false" estimated_delivery_date="2013-07-26" base_charge="11.05" freight_charge="11.05"residential_address_charge="2.75" net_charge="13.80" fuel_surcharge_rate="15.8" fuel_surcharge="1.75" subtotal_charge="15.55" on_hst_charge="2.02" total_charge="17.57"/> </rating> I have an RSA key, SSL cert, CA bundle and a password and need to use that information to authenticate with the https url. What is the best working way to accomplish this?
  5. Hey, I'd like to grab xml data by passing get variables through an https ssl secured url and then parse it. What would be the best way to go about doing that and is there a solid tutorial with step by step on how to do that? Thanks for your time!
  6. Hello All, I would like to get all Equipment values. I have used DOM Document. It is reading ONLY LAST Element. Equipment Id: 28. I need all three. Thanks in advanced. XML File: <?xml version="1.0" encoding="UTF-8"?> -<Physical> <Catalog> </Catalog> -<Installed> -<Equipment> <Id>26</Id> <Ref>Tew12</Ref> -<Characteristic> <CharacteristicName>Height</CharacteristicName> <CharacteristicValue>160</CharacteristicValue> </Characteristic> -<Characteristic> <CharacteristicName>Tilt</CharacteristicName> <CharacteristicValue>30</CharacteristicValue> </Equipment> -<Equipment> <Id>27</Id> <Ref>Tew13</Ref> -<Characteristic> <CharacteristicName>Height</CharacteristicName> <CharacteristicValue>165</CharacteristicValue> </Characteristic> -<Characteristic> <CharacteristicName>Tilt</CharacteristicName> <CharacteristicValue>50</CharacteristicValue> </Equipment> -<Equipment> <Id>28</Id> <Ref>Tew14</Ref> -<Characteristic> <CharacteristicName>Height</CharacteristicName> <CharacteristicValue>190</CharacteristicValue> </Characteristic> -<Characteristic> <CharacteristicName>Tilt</CharacteristicName> <CharacteristicValue>50</CharacteristicValue> </Equipment> </Installed> </Physical> Expected Result: Id 26 Tilt 30 Id 27 Tilt 50 Id 28 Tilt 50 For the moment, i am trying to get all Ids values. Still it is not giving ALL Ids. It should give Ids: 26 27 28 $Equipments = $dom->getElementsByTagName('Equipment'); foreach( $Equipments as $Equipments ) { $Ids = $Equipments->getElementsByTagName( 'Id' ); $Id = $Ids->item(0)->nodeValue; echo $Id; }
  7. <?xml version="1.0" encoding="utf-8"?> <home> <firstHeader>Welcome to my Site</firstHeader> <firstParagraph>You are here because your not there.</firstParagraph> <secondParagraph>You are Ugly because we are beautiful</secondParagraph> <thirdParagraph>If there no ugly people then there is no beautul people.</secondParagraph> <question>Make sense right?</question> </home> How do I translate the data of the xml file to other language? Anyones have an idea? or what tools should I use?
  8. Good day, I have a task that require the page to be translated to other language. What the MAN want is to pass all the content of a page to an XML file and then translate all the content and return it in a language choosen. My question is, is this possible? if it is where will I start , cause I don't know really about XML. . By the way I'm using a framework codeigniter, I tried the localization function of the codeigniter and It was okay but it is not the MAN wants. Maybe anyone knows something about codeigniter that can help me. .
  9. Hi all, I have a problem with a crosstable. I want to auto fill the empty cell with black background. The code now downloads the xml and fills each cell with the proper content, but leaves some empte with cells. As for now I have the following structure where [bLACK] at this points still is white without content <table> [bLACK][2][3][4] [1][bLACK][3][4] [1][2][bLACK][4] [1][2][3][bLACK] </table> $countries = array(); $dom = new DOMDocument(); $dom->load('http://www.antilopen.nl/competitie/kruistabel.asp?ci=314&xml=314&t=1'); echo "<table>"; $aantalrijen=$dom->getElementsByTagName('row')->length-1; for ($i = 0 ; $i <= $aantalrijen ; $i++) { ?> <tr class="<?php echo ($clrCounter++ % 2 == 0 ? 'odd' : 'even'); ?>"> <? foreach ($dom->getElementsByTagName('rij_'.$i) as $entry) { echo "<td style=\"padding: 10px\">"; echo $entry->nodeValue; echo "</td>"; } echo "</tr>"; } echo "</table>"; ?>
  10. I have been googling the crap out of this, and I can not find the answer. I've been working on a flash game for quite some time now, and I want to incorporate an online saving ystem. I already understand that getting this to work involves XML and PHP. I already have a small script that displays a change log that I can update when I want, sort of acts as a place holder so things can stay organized. The swf in question is being hosted in my dropbox account, so servers have already been covered. I already know how to communicate between the AS files, XML files, and PHP files, but I can't seem to find any thing on how to save/write information that's been fed to the PHP/XML codes. How would I go about this?
  11. Hi All, I`m pretty new with php but i`m trying to build a mobile page with xml extraction. I`m getting my xml data from an externa site trough simplexml and I want to sort this data on weeknumber, and within the weeknumber on team. The xml data that i`m requesting is <Datum_Tijd> and I want to transform it to a weeknumber.: xml code: <code> A2M 7688 15-5-2013 19:30:00 IJsselvogels A2 DVS '69 A1 7 8 </code> Until now I have this to witdraw my content: <code> <table cellpadding="1px" width="100%"> <tr align="left"> <th>Datum</th><th>Tijd</th><th>Thuis Ploeg</th><th>Uit Ploeg</th><th>Uitslag</th> </tr> <?php foreach ($xml->row AS $info ) { ?> <tr class="<?php echo ($clrCounter++ % 2 == 0 ? 'odd' : 'even'); ?>"> <td><?php $date = date_create($info -> Datum_Tijd); echo date_format($date, 'd-m');?></td> <td><?php $date = date_create($info -> Datum_Tijd); echo date_format($date, 'H:i');?></td> <td <?php if (strpos($info -> Thuisploeg,'IJsselvogels') !== false) {echo 'style="color: #FF0000;"';} ?> ><?php echo $info -> Thuisploeg ?></td> <td <?php if (strpos($info -> Uitploeg,'IJsselvogels') !== false) {echo 'style="color: #FF0000;"';} ?> ><?php echo $info -> Uitploeg ?></td> <td><?php echo $info -> Scorethuis . " - " . $info -> Scoreuit ?></td> </tr> <? }?> </code> But I want: Week 14: result team1 result team2 etc. week 13: result team1 result team2 etc. can you help?
  12. Hallo allemaal, Ik heb via een xml data uit een kruistabel gehaald, en deze netjes in een tabel geplaatst. Tot zover gaat het allemaal goed. Maar ik wil graag de niet gebruikte cellen in de kruistabel zwart vullen, zodat je direct ziet dat deze niet gebruikt wordt: Een voorbeeld van de xml is: <root> <row> <Klasse>A1F</Klasse> <rij_0/> <rij_1>Fortuna A2</rij_1> <rij_2>IJsselvogels A1</rij_2> <rij_3>KCR A2</rij_3> <rij_4>KOAG A1</rij_4> <rij_5>KVS A2</rij_5> <rij_6>ODO A1</rij_6> <rij_7>Vitesse A1</rij_7> <rij_8>Weidevogels A1</rij_8> </row> <row> <Klasse>A1F</Klasse> <rij_0>Fortuna / MHIR A2</rij_0> <rij_1/> <rij_2>8 - 20</rij_2> <rij_3>6 - 8</rij_3> <rij_4>5 - 17</rij_4> <rij_5/> <rij_6>10 - 17</rij_6> <rij_7>9 - 9</rij_7> <rij_8>14 - 16</rij_8> </row> <row> <Klasse>A1F</Klasse> <rij_0>IJsselvogels A1</rij_0> <rij_1/> <rij_2/> <rij_3>14 - 14</rij_3> <rij_4>5 - 8</rij_4> <rij_5>11 - 8</rij_5> <rij_6/> <rij_7>9 - 6</rij_7> <rij_8>13 - 13</rij_8> </row> <row> <Klasse>A1F</Klasse> <rij_0>KCR A2</rij_0> <rij_1>16 - 11</rij_1> <rij_2>7 - 17</rij_2> <rij_3/> <rij_4>7 - 13</rij_4> <rij_5>13 - 5</rij_5> <rij_6>7 - 12</rij_6> <rij_7/> <rij_8>11 - 10</rij_8> </row> <row> <Klasse>A1F</Klasse> <rij_0>KOAG A1</rij_0> <rij_1/> <rij_2>7 - 6</rij_2> <rij_3>13 - 7</rij_3> <rij_4/> <rij_5>17 - 3</rij_5> <rij_6>18 - 8</rij_6> <rij_7>14 - 7</rij_7> <rij_8>15 - 6</rij_8> </row> <row> <Klasse>A1F</Klasse> <rij_0>KVS A2</rij_0> <rij_1>10 - 9</rij_1> <rij_2>7 - 17</rij_2> <rij_3>11 - 7</rij_3> <rij_4>4 - 16</rij_4> <rij_5/> <rij_6>6 - 18</rij_6> <rij_7>8 - 17</rij_7> <rij_8/> </row> <row> <Klasse>A1F</Klasse> <rij_0>ODO A1</rij_0> <rij_1>10 - 5</rij_1> <rij_2>10 - 4</rij_2> <rij_3/> <rij_4>9 - 10</rij_4> <rij_5>19 - 11</rij_5> <rij_6/> <rij_7/> <rij_8>13 - 7</rij_8> </row> <row> <Klasse>A1F</Klasse> <rij_0>Vitesse A1</rij_0> <rij_1>17 - 6</rij_1> <rij_2/> <rij_3>14 - 5</rij_3> <rij_4>9 - 11</rij_4> <rij_5>16 - 10</rij_5> <rij_6>8 - 9</rij_6> <rij_7/> <rij_8>9 - 7</rij_8> </row> <row> <Klasse>A1F</Klasse> <rij_0>Weidevogels A1</rij_0> <rij_1>14 - 9</rij_1> <rij_2>12 - 15</rij_2> <rij_3>12 - 8</rij_3> <rij_4/> <rij_5>7 - 7</rij_5> <rij_6>13 - 14</rij_6> <rij_7>9 - 11</rij_7> <rij_8/> </row> </root> Zijn er mensen die er ervaring mee hebben? Vraag 2: Ik heb nu handmatig de rijen 0 - 8 als rij ingevoerd, is het mogelijk om de rijen automatisch op basis van de xml te vullen, en daarnaast ook de velden in de <th> velden om die automatisch te vullen? Kruistabel <table cellpadding="1px" width="100%"> <tr align="left"> <th><?php echo $kruistabel -> rij_0 ?></th><th><?php echo $kruistabel -> rij_1 ?></th><th><?php echo $kruistabel -> rij_2 ?></th><th><?php echo $kruistabel -> rij_3 ?></th><th><?php echo $kruistabel -> rij_4 ?></th><th><?php echo $kruistabel -> rij_5 ?></th> </tr> <? foreach ( $xmlkruis->row AS $kruistabel ) { ?> <tr class="<?php echo ($clrCounter++ % 2 == 0 ? 'odd' : 'even'); ?>"> <td><?php echo $kruistabel -> rij_0 ?></td> <td><?php echo $kruistabel -> rij_1 ?></td> <td><?php echo $kruistabel -> rij_2 ?></td> <td><?php echo $kruistabel -> rij_3 ?></td> <td><?php echo $kruistabel -> rij_4 ?></td> <td><?php echo $kruistabel -> rij_5 ?></td> <td><?php echo $kruistabel -> rij_6 ?></td> <td><?php echo $kruistabel -> rij_7 ?></td> <td><?php echo $kruistabel -> rij_8 ?></td> </tr> <?}?> </table>
  13. Hoi Allemaal, Ik ben nog redelijk nieuw met het programmeren van PHP en ben bezig met een mobiele pagina. Ik haal via xml gegevens van een externe site en wil deze weergeven op de pagina. De pagina laat gegevens uit de xml zien maar wil deze nu sorteren op weeknummer. De XML gegevens die ik opvraag is, waarbij ik <Datum_Tijd> gebruik om de weeknummer te bepalen: <root> <row> <Klassenaam>A2M</Klassenaam> <Wedstrijdnummer>7688</Wedstrijdnummer> 15-5-2013 19:30:00 <Thuisploeg>IJsselvogels A2</Thuisploeg> <Uitploeg>DVS '69 A1</Uitploeg> <Scorethuis>7</Scorethuis> <Scoreuit>8</Scoreuit> <Opmerking/> </row> <row> Tot dusver heb ik dit, dit laat keurig de uitslagen zien: natuurlijk na het laden van de xml met simplexml: <table cellpadding="1px" width="100%"> <tr align="left"> <th>Datum</th><th>Tijd</th><th>Thuis Ploeg</th><th>Uit Ploeg</th><th>Uitslag</th> </tr> <?php foreach ($xml->row AS $info ) { ?> <tr class="<?php echo ($clrCounter++ % 2 == 0 ? 'odd' : 'even'); ?>"> <td><?php $date = date_create($info -> Datum_Tijd); echo date_format($date, 'd-m');?></td> <td><?php $date = date_create($info -> Datum_Tijd); echo date_format($date, 'H:i');?></td> <td <?php if (strpos($info -> Thuisploeg,'IJsselvogels') !== false) {echo 'style="color: #FF0000;"';} ?> ><?php echo $info -> Thuisploeg ?></td> <td <?php if (strpos($info -> Uitploeg,'IJsselvogels') !== false) {echo 'style="color: #FF0000;"';} ?> ><?php echo $info -> Uitploeg ?></td> <td><?php echo $info -> Scorethuis . " - " . $info -> Scoreuit ?></td> </tr> <? }?> Maar ik wil dus (waarbij de weeknummer de afgelopen 2 weken zijn): Week 14: uitslag team1 uitslag team2 etc. week 13: uitslag team1 uitslag team2 etc. Kunnen jullie helpen?
  14. XPATH method for retuning multiple dynamic results from a XML file using PHP I have a form that the user types or selects a value the form is as follows <form id="search_photos" action="photo_result.php" method="get"> <input value="" name="photographer_id" id="photographer_id" style=" border:1px solid Silver;" type="text"> <select name="Photographer" id="Photographer" style="height:23px; border:1px solid Silver;"> <option selected="selected" value="x">Any Photographer</option> <option value="John">John</option> <option value="Fred">Fred</option> <option value="Joseph">Joseph</option> </select> <select name="images" id="images" style="height:23px; border:1px solid Silver;"> <option selected="selected" value="x">All Images</option> <option value="0">None</option> <option value="a">Image a</option> <option value="b">Image b </option> <option value="c">Image c </option> </select> <input name="Submit" value="Search Now >" id="Submit" class="Adv1_Filter_Button" type="submit"> </form> Then the search_photo.php script that catches the result of the form and filters the values entered by the user as follows <?php $xml = simplexml_load_file("photo.xml"); for ($i = 0; $i < count($xml); $i++){ if(isset($_GET["LocationName"])) { $photographer_id = $_GET["LocationName"]; } $result = $xml->xpath('/root/area[photographer_id=' . $photographer_id . '] '); } if(isset($_GET["Photographer"])) { $photographer = $_GET["Photographer"]; } $result = $xml->xpath('/root/area[photographer_id=' . $photographer_id . '] '); if(isset($_GET["images"])) { $image = $_GET["images"]; } echo $photographer_id; echo $photographer; echo $image; var_dump ($result); ?> The $result from the first XPATH pass is correct if all that is set is ‘photographer_id’ if I then try $result=$xml->xpath ('/root/area[photographer_id=' . $photographer_id . '] | /root/area[photographer=' . $photographer .']'); and select 1 and fred then I get the result of an array of all four when it should be an empty array I have trie & (and) insted of | (or) but just returns an empty array should I convert the $result to an object or is the a way of saving the $result to an xml file
  15. Cannot receive HTTP POST data from Device Magic (DM) form automation website. I get this error: Fatal error: Call to a member function getName() on a non-object in /portfolio/submissions/index.php on line 8 For this code: <?php $raw_body = file_get_contents("php://input"); $xml = simplexml_load_string($raw_body); echo $xml->getName()."\n<br />"; ?> So Instead I try with FireFox REST client (and use the data that should be sent from DM) and do the same as written in my first post and I get a reply - the root node name. Why does the FF REST client work and my website does not? Many thanks
  16. Hi all I've got a slight problem adding some XML data to a MySQL database. My code looks like: // Load XML file $xml = simplexml_load_file('products.xml') or die ("Could not load XML file"); // Database variables $host = "localhost"; $username = "user_name"; $password = "pass_word"; $dbname = "database_name"; // Foreach piece of XML data - send to MySQL database and put into the xmlFeed_db database foreach ($xml->product as $data) { // MySQL connect to database $con = mysql_connect("$host", "$username", "$password") or die ("Unable to connect to database"); $select_db = mysql_select_db($dbname) or die ("Unable to select database"); // Put all data into numerous variables $id = $data->id; $man = $data->manufacturers; $des = $data->description; $price = $data->price; $sku = $data->sku; $category = $data->category; $subcategory = $data->subcategory; // SQL statement $query = "INSERT INTO tablename VALUES ('$id','$man','$des','$price','$sku','$category','$subcategory')"; // Execute SQL statement mysql_query($query) or die ("Insertion Error: " . mysql_error()); // Close MySQL mysql_close(); When I run this script it only stores 249 rows out of 2000 and then it shows an error stating: "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 's)', '117.08','CAB-OCTAL-ASYNC=','Networking','Networking Cables')' at line 1" Does anyone know why this error message is showing? I've looked at my syntax but I can't see a problem. Maybe a fresh pair of eyes can help. Thanks
  17. Trying to get XML POSTed to my website using the code below: To test that I am getting anything (which I do not at the moment) to my website I use this code: print "CONTENT_TYPE: " . $_SERVER['CONTENT_TYPE'] . "<BR />"; $data = file_get_contents('php://input'); print "DATA: <pre>"; var_dump($data); var_dump($_POST); print "</pre>"; This is my website: http://www.jonathonbates.info/submissions/deliver/index.php This is the XML that I should receive: <?xml version="1.0"?> <instance xmlns="http://www.devicemagic.com/xforms/**private form ID**" xmlns:dm="http://mobileforms.devicemagic.com/xforms" writeTime="2013-05-03T06:24:08-07:00" dm:submitting_user="Monk" dm:submitting_device="Android_**private ID**" dm:submit_time="2013-05-03 13:24:08 UTC" dm:form="test_form" dm:form_version="1.00"> <inputs> <test_1_not_populated>leverage real-time web services</test_1_not_populated> <test_2_populated>exploit dynamic portals</test_2_populated> <test_3_db_populated>synthesize dot-com users</test_3_db_populated> </inputs> </instance> The website that I have created is for receiving XML on a custom connection setup on a website called Device Magic - basicaly automates PUSHing forms to mobile client devices. I have set the destination (my website) within Device Magic and have only tried adding header 'Content-Type: Application/XML' as another idea. Please suggest why I receive nothing or what I could do to fix this. Many thanks
  18. 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!!
  19. i am trying to make an update script using an xml with a login username / password authorization. i have never encountered one before one looking to see if anyone could point me in the right direction. any questions please ask matt
  20. I'm trying to pick out items from an XML file by their titles using Xpath in DOM, but because some have apostrophes, and others have quotes, it doesn't work. I've tried replacing the apostrophes using this $query1 = 'channel/item[title='.$p.']/title'; but it only works for the apostrophes, not the quotes. Any advice on how to do this? <?php $q = $_GET["q"]; $q = explode('|^', $q); $counts = count($q); unset($q[$counts-1]); $p = stripslashes($q); $q = stripslashes($p); $dom = new DOMDocument; $dom->preserveWhiteSpace = false; $dom->formatOutput = true; $dom->Load("../$userid.xml"); $xpath = new DOMXPath($dom); foreach ($q as $r) { $p = preg_replace("/'/","",$r); $query1 = "channel/item[title="'.$p.']/title"; $query2 = "channel/item[title="'.$p.']/url"; $query3 = "channel/item[title="'.$p.']"; $entries = $xpath->query($query1); $entries2 = $xpath->query($query2); $entries3 = $xpath->query($query3); foreach ($entries as $entry) { foreach ($entries2 as $entry2) { foreach ($entries3 as $entry3) { $oldchapter = $entry->parentNode->removeChild($entry); $oldchapter2 = $entry2->parentNode->removeChild($entry2); $oldchapter3 = $entry3->parentNode->removeChild($entry3); $dom->preserveWhiteSpace = false; } } } } $dom->formatOutput = true; $dom->save("../$userid.xml") ?> Basically, my code extracts titles from a URL, separated by "|^" (For example title1|^title2|^title3|^). Because the "|^" is appended to the end of each title, I have to remove the empty value from the array. Then, because the titles with apostrophes come in like "Title\\'s", I have to strip slashes twice to get rid of them. Then I load a new DOMdocument, and find the titles from the URL in my existing XML document. Then I want the code to remove the whole items (titles, urls and the item itself) which have the same titles as the ones in the URL, and then save the document.
  21. Basically, I am writing a script in PHP, which can take YouTube videos from playlists, items from RSS feeds and podcasts, and individual YouTube videos and files, and places them into an XML document, so they can browsed and kept in one place. I also have a script which removes these items, if the user wants. The problem I'm facing is with characters. Because I can't control what the user will name their videos/files, or how they're named in the feed, the titles could have quotes, brackets, ampersands, hashes etc, which causes problems when they're being removed and Because I'm using Xpath (which can be temperamental at the best of times) in the remove script, any items with titles with these characters won't get removed. Here's my remove code: <?php $q = $_GET["q"]; $q = stripslashes($q); $q = explode('|^', $q); $counts = count($q); unset($q[$counts-1]); $dom = new DOMDocument; $dom->preserveWhiteSpace = false; $dom->formatOutput = true; $dom->Load("../$userid.xml"); $xpath = new DOMXPath($dom); foreach ($q as $r) { $r = preg_replace("|&|", '&', $r); $r = preg_replace('|"|', '"', $r); $query1 = 'channel/item[title='.$r.']/title'; $query2 = 'channel/item[title='.$r.']/media:content'; $query3 = 'channel/item[title='.$r.']'; $entries = $xpath->query($query1); $entries2 = $xpath->query($query2); $entries3 = $xpath->query($query3); foreach ($entries as $entry) { foreach ($entries2 as $entry2) { foreach ($entries3 as $entry3) { $oldchapter = $entry->parentNode->removeChild($entry); $oldchapter2 = $entry2->parentNode->removeChild($entry2); $oldchapter3 = $entry3->parentNode->removeChild($entry3); $dom->preserveWhiteSpace = false; } } } } $dom->preserveWhiteSpace = false; $dom->formatOutput = true; $dom->save("../$userid.xml") ?> How it works is when the user selects the items they want to remove, using a select box, the selections are put into the URL. My code extracts the titles from the URL, separated by "|^" (For example title1|^title2|^title3|^). Because the "|^" is appended to the end of each title, I have to remove the empty value from the array. Then I load a new DOMdocument, and find the titles from the URL in my existing XML document. Then I want the code to remove the whole items (titles, urls and the item itself) which have the same titles as the ones in the URL, and then save the document, but because some of the titles could have &, ", * or #, they don't get removed. Is there a way that I can maybe screen, and change the characters to get it to work (I tried this with "preg_replace", but it didn't work), or even change them before they're saved to the XML in the first place? Any advice?
  22. I have several xml files in a folder on my webserver. I want to 1. look in the folder 2. get xml file names 3. put file names into array 4. loop those names into a mysql query 5. have contents of all xml files inserted into db $files = glob('*.xml'); foreach($files as $file){ mysql_query("LOAD DATA INFILE '".$file."' INTO TABLE tablename ROWS IDENTIFIED BY ''"); } I've spent a couple of days looking for an example or tutorial but can't find anything online. Above is the best I can come up with. Any help appreciated
  23. Hello fellow programmers, I'm having problem with passing soap request this xml schema is the SOAP request I must pass to the server : http://pastebin.com/1PjXzVLm I use this code http://pastebin.com/tgspY7rg but I don't seem to succeed, any help is appreciated
  24. Recently i have started Flight portal website. In that for displaying the details of flight like availability, cancellation , fare , etc.. i am sending a SOAP XML request in php the code is as below <?php $xml_data="<arzHotelAvailReq><clientInfo> <username>UdooInXML</username> <userType>ArzooHWS1.1</userType> <userID>77743543</userID> <password>*CB8</password> <partnerID>1002</partnerID> </clientInfo> <requestSegment> <currency>INR</currency> <searchType>search</searchType> <residentOfIndia>true</residentOfIndia> <stayDateRange> <start>22/03/2013</start> <end>23/03/2013</end> </stayDateRange> <roomStayCandidate> <guestDetails> <adults>1</adults> <child> <age>3</age> <age>5</age> </child> </guestDetails> <guestDetails> <adults>2</adults> <child> <age>2</age> </child> </guestDetails> </roomStayCandidate> <hotelSearchCriteria> <hotelCityName>BANGALORE</hotelCityName> <hotelName></hotelName> <area></area> <attraction></attraction> <rating></rating> <sortingPreference>1 </sortingPreference> <hotelPackage>Y</hotelPackage></hotelSearchCriteria></requestSegment></arzHotelAvailReq> "; Here the soap client request code comes. and i am getting the response. Everything is fine upto here. But i am getting the response in a irregular text format like as below. 100200 INR search 22/03/2013 23/03/2013 1 3 5 2 2 BANGALORE 1 Y true 00005380 Veekay Tourist Home Overlooking the beautiful park, this homely abode is close to the ISKON Temple. Across three floors are 80 AC and non-AC rooms, which are maintained with room service. Guests can experience the essence of the city with a tour, which is organized by the home on demand. There is free parking facility provided to the guests to park their vehicles. 1 2 400 033 arzooB 91/1, Railway Parallel Road Yeshwantpur NA Overlooking the beautiful park, this homely abode is close to the ISKON Temple. Across three floors are 80 AC and non-AC rooms, which are maintained with room service. Guests can experience the essence of the city with a tour, which is organized by the home on demand. There is free parking facility provided to the guests to park their vehicles. NA NA NA NA 00:00 12:00 All NA NA Air_Conditioning,Restaurant,Conference_Hall,Health_Club,Travel_Desk,Transfers,Forex,Shopping,Swimming,Banquet,Business_Center NA cdn.travelpartnerweb.com/DesiyaImages/Image/1/nxd/maw/ryj/lbn/HO_TN.jpg N N Non AC Room No Amenities 0000019527 0000068265 11111111 +yWrLQerwfpRqCOBdo4d4Q+fTZgh1nupLJ4p4u6ke0DnoKrM1YnV+CyeKeLupHtAek/xho0eiejEOsNqkniCrj61Dp4lgPVpxhyWcxAZvAY6eaST9cxEwO77vKeHzGt7xDrDapJ4gq4OONbvuHIwesuQNW1tG3pMLXm9B6RXzcuVQyNiR9Nkmc5UwHnlMe/3R4pOa9nZpzWvpc4Pgi4QldI0kqzTn0R2SrrkswfU4tEe+FrLnNX0ikMr6KYsRwZ5weOUbgjswoE6Gc2xDYzFhoJPdnFEgTGV53WGRs0ArO3XjoptM/3++Ebal1NQKw41+CLkev7bTS2uy9dZCeYpxW/ouG38h9xmYh+h8WdKEfuf5HK8TIYqr3cMt7sdhfmbFluz6IhIkl5gGOFLUgob5fJgMkJc5m29X6/0s/8xt7Kj8slKZijCITtF+SlZboPr 84 751 0 0.0 0 N N AC Double No Amenities 0000019528 0000068266 11111111 MqJjfxbuxrY6eaST9cxEwDETzbfNeAOGmk9s1Uz6PbYSZIViwgQiY5pPbNVM+j22FHM8WEydgwBkOaDlTL6ZjC9zLGtHv0ypOnmkk/XMRMAPn02YIdZ7qUC2Sm/k4OAAweOUbgjswoF0RTNIMdh6k+Ld9K5fVWUdDznXXQXDz4XzARG+d1YhoTBLNxtfNxqmAcSIgU/v1x3EOsNqkniCrr6b1Ug4ytFJZ/0FayiZJBkPeiwpn9EJwEbIPnPEbTR4lWhM0grn0WLZ56unmN2SYl3cbsmEPmwq2OuHVC1F8Hu84Nfh1MF/h4/ba1HimMaE+uDhm6Ks2qonJVGPUcpVXdQrEjcaz9CVv8aChDAx1MrEOsNqkniCrtPU6ffG6Zo+VJRf6bY5MD9Jpvu9wmltGrCdLm1c957TFF2epIoxL54OaXRTmdyfd1yCAU1C72cA 0 1684 60 0.0 0 00005020 U.G.DELUXE Located near to the Srinivasa Nursing Home, this brand new smoke-free property on the block is maintained with 42 deluxe rooms, which includes A/C and non-A/C accommodations. There are three dining outlets, namely Malabar Vegetarian Restaurant, Krishna Bhavan, and Sukh Sagar, which are all open for service from 6a.m to 10p.m. The property is designed with a garden area, where guests can lounge. They can also avail the assistance of the travel desk and take a tour of the beautiful city. 0 2 550 061 arzooB #9/1, 2nd Cross,Thulasithotam Balepet Near Srinivasa Nursing Home NA Located near to the Srinivasa Nursing Home, this brand new smoke-free property on the block is maintained with 42 deluxe rooms, which includes A/C and non-A/C accommodations. There are three dining outlets, namely Malabar Vegetarian Restaurant, Krishna Bhavan, and Sukh Sagar, which are all open for service from 6a.m to 10p.m. The property is designed with a garden area, where guests can lounge. They can also avail the assistance of the travel desk and take a tour of the beautiful city. NA NA NA NA 00:00 12:00 All NA NA Air_Conditioning,Restaurant,Conference_Hall,Health_Club,Travel_Desk,Transfers,Forex,Shopping,Swimming,Banquet,Business_Center NA cdn.travelpartnerweb.com/DesiyaImages/Image/1/nxd/maw/rym/fbn/HO_TN.jpg N N Double Deluxe Non AC No Amenities 0000018167 0000058501 11111111 6rHbdJ5eYI7GHJZzEBm8BvOaNWWi+RUhLJ4p4u6ke0DPzHJ7gHRp3iyeKeLupHtAhduj3Vq+cinEOsNqkniCrj61Dp4lgPVpxhyWcxAZvAY6eaST9cxEwO77vKeHzGt7xDrDapJ4gq4OONbvuHIwepH1wYi4aVVmDxAoeeQIBeo7G/tKB6tJOYDfWwbV0F7ASAS/psz+s/vtFOZDhaz6EtGf96t/LsuWxw1Qqnbhmf3XYWyQ7VUjC8Q6w2qSeIKuoKFs0O+FVtNhRIfAcxLjf86bGU9wLBRNvD/Qlqcc//JzmIzIGoODhM1oJoq2rZMN1gD5nlU38lH0iT7gaoTgQlkLlahFGUKDXPHozEiWFpzUKxI3Gs/Qlb/GgoQwMdTKxDrDapJ4gq7T1On3xumaPlSUX+m2OTA/Sab7vcJpbRqwnS5tXPee0xRdnqSKMS+eDml0U5ncn3eFGMF7Jssn/w== 0 966 44 0.0 0 N N Double Deluxe AC No Amenities 0000018168 0000058502 11111111 sSCoszzZkH86eaST9cxEwDETzbfNeAOGmk9s1Uz6PbZGv/SG567OsZpPbNVM+j22DfbGKTDMXKFkOaDlTL6ZjC9zLGtHv0ypOnmkk/XMRMAPn02YIdZ7qUC2Sm/k4OAAweOUbgjswoF0RTNIMdh6kznLtLUAmNXdxBAFTfOqI33OVMB55THv90eKTmvZ2ac1r6XOD4IuEJXSNJKs059Edkq65LMH1OLRxhyWcxAZvAZDK+imLEcGecHjlG4I7MKBOhnNsQ2MxYZ+oLyPTZ3RMaAnkAotaRPKKfHYXniQp/S8zzpKPZaLArk7+CKaeLo9hOB8fqTxssT128imfeXuC/OgEXYIgsG2UHFvTjsO+sCf5HK8TIYqr+4vK3ryvrJwFluz6IhIkl4/hAHmlwnis6hroDhh/C42mx8+gs3lzQiWJgzCcdsB9fCEqLc7/4v1LJ4p4u6ke0CUdoTzsl6ZtBfc5EobFJGF 0 1318 60 0.0 0 00004788 U.G.ROYAL Strategically located near to the railway station by 2kms, this smoke-free property is designed with 3floors with an elevator, and maintained with 24 rooms to reside in. The property is also maintained with a garden space and a travel counter for all travel assistance. A vegetarian fare can be savoured in the nearby Sukh Sagar Restaurant and non-vegetarian fare can be relished in any of the neighboring dining outlets, namely New Grand and Hyderabad. 0 2 650 062 arzooB # 42, Cottonpet Main Road NA Strategically located near to the railway station by 2kms, this smoke-free property is designed with 3floors with an elevator, and maintained with 24 rooms to reside in. The property is also maintained with a garden space and a travel counter for all travel assistance. A vegetarian fare can be savoured in the nearby Sukh Sagar Restaurant and non-vegetarian fare can be relished in any of the neighboring dining outlets, namely New Grand and Hyderabad. NA NA NA NA 00:00 12:00 All NA NA Air_Conditioning,Restaurant,Conference_Hall,Health_Club,Travel_Desk,Transfers,Forex,Shopping,Swimming,Banquet,Business_Center NA cdn.travelpartnerweb.com/DesiyaImages/Image/1/nxd/maw/syf/lbv/HO_TN.jpg N N Double Deluxe Non AC No Amenities 0000017219 0000054610 11111111 oHS5Xd5Exyg6eaST9cxEwGZSjnNN3mhmmk9s1Uz6PbaNc1sEsAf/6JpPbNVM+j22if6NKX9Uk13Dy1lDA4noii9zLGtHv0ypOnmkk/XMRMAPn02YIdZ7qUC2Sm/k4OAAweOUbgjswoF0RTNIMdh6kznLtLUAmNXdU8J0wP+0TP07G/tKB6tJOYDfWwbV0F7ASAS/psz+s/vtFOZDhaz6EtGf96t/LsuWxw1Qqnbhmf3XYWyQ7VUjC8Q6w2qSeIKuoKFs0O+FVtN4j8rH+f6mNO5qfq4xpPlORexVeZq9N0yqKIuRorLprNQrEjcaz9CVv8aChDAx1MrEOsNqkniCrtPU6ffG6Zo+VJRf6bY5MD9Jpvu9wmltGrCdLm1c957TFF2epIoxL54OaXRTmdyfd0BBbtk2xLpA 0 1142 52 0.0 0 N N Deluxe Double AC No Amenities 0000017221 0000054612 11111111 TxbgXP3Nk6o6eaST9cxEwO0QCFlSnc8Cmk9s1Uz6PbaNc1sEsAf/6JpPbNVM+j22fMzm237c+vR3p+iuYvo+Ai9zLGtHv0ypOnmkk/XMRMAPn02YIdZ7qUC2Sm/k4OAAweOUbgjswoF0RTNIMdh6kznLtLUAmNXdU8J0wP+0TP07G/tKB6tJOYDfWwbV0F7ASAS/psz+s/vtFOZDhaz6EtGf96t/LsuWxw1Qqnbhmf3XYWyQ7VUjC8Q6w2qSeIKuoKFs0O+FVtN4j8rH+f6mNO5qfq4xpPlORexVeZq9N0yqKIuRorLprNQrEjcaz9CVv8aChDAx1MrEOsNqkniCrtPU6ffG6Zo+VJRf6bY5MD9Jpvu9wmltGrCdLm1c957TFF2epIoxL54OaXRTmdyfd4cJw1cUhwyo 0 1580 72 0.0 0 00004786 U.G.GRAND A large photo frame of Lord Venkatesh at the lobby welcomes guests to a comfortable stay in this four floors hotel located in the NP Lane. There are 16 rooms facilitated with 24hours room service. A vegetarian fare can be relished at the Krishna Sagar Delhi Restaurant, which is open for service from 6a.m. to 10a.m., and non-vegetarian fare can be savoured in the Hyderabad Biryani Restaurant, which can be visited between 10a.m. to 11p.m. There is free valet parking facility also available in this hotel. 0 2 650 108 arzooB NO.10,N.P. LANE,COTTON PET BEHIND SHANTALA SILKS So here i want to arrange that response in a designed format. How can i do that. Please give me your valuable suggestions. Thanks in advance, Sree ram
  25. I have a feed that contains over 10000 vehicles and is about 300 mb and trying to grab and display the name and the price of each vehicle.The problem is it displays all the data in the feed. Below is the feed that i used <vehicle> <type>Double Cab </type> <price>19.5k</price> <model>GTX</model> <descrip>sdsadasdasdsa</descrip> </vehicle> <vehicle> <type>Cruise </type> <price>78k</price> <model>Ultra</model> <descrip>sdsadasdasdsa</descrip> </vehicle> <vehicle> <type>Jeep/ Wagon </type> <price>2k</price> <model>Body Kit</model> <descrip>sdsadasdasdsa</descrip> </vehicle> I’m using the below code. $url = 'vcfeed.php'; $xname ="test"; $xPassword ="testuser"; $post_data = array("username" => $xname, "password" => $xPassword"); $ch = curl_init($url); $c[CURLOPT_POST] = true; $c[CURLOPT_POSTFIELDS] = $post_data; foreach($c as $k=>$v){$c[$k] = $v;} curl_setopt_array($ch,$c); $xml = curl_exec($ch); curl_close($ch); $z = new XMLReader; $z->open($xml); $doc = new DOMDocument; while ($z->read() && $z->name !== 'vehicle'); while ($z->name === 'vehicle') { $node = simplexml_import_dom($doc->importNode($z->expand(), true)); echo $node->model; echo $node->price; $z->next('vehicle'); } Although i have used echo $node->model; echo $node->price; It doesn’t show those 2 values for each result. Can someone tell me what am i doing wrong here?
×
×
  • 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.