English 中文(简体)
如何利用PHP从XML和/或JSON中提取/拥有数据
原标题:how to extract/session data from XML and/or JSON using PHP

I inserted the below command in developer.yahoo.com/yql/console/

yql = select * from yahoo.finance.quotes where symbol in ("XAUUSD=X","XAGUSD=X")

but show all the datas which are not necessary to me. XML Code Generated by Yahoo YQL and Json Code Generated by Yahoo YQL

i 只是想退出Ask、Bid、AskRealtime、BidRealtime、最后一次贸易Realtime Withtime, Last TradeWithtime, Last TradePriceOnly. 我通过使用“加拿大”会议,希望在同一页内将所收集的数据列入“html”表/div。

不能把XML或Json的数据引出。 对于我来说,比较容易地 gr取田地和会场数据,并将数据抄送html表。

And also want the grabbed data to be streamable or auto refresh when datas are refreshed in yahoo ..
found this link
streamerapi.finance.yahoo.com

but got no idea how to work please help

i tried this but printed nothing

<script type= text/javascript >  
  function forex(o){  
    var items = o.query.results.item;  
    var output =   ;  
    var no_items=items.length;  
    for(var i=0;i<no_items;i++){  
      var Ask = items[i].Ask;
      var AskRealtime = items[i].AskRealtime;
      var BidRealtime = items[i].BidRealtime;
      var LastTradeDate = items[i].LastTradeDate;
      var LastTradePriceOnly = items[i].LastTradePriceOnly;
      var LastTradeTime = items[i].LastTradeTime;
      output += Ask + AskRealtime + BidRealtime + LastTradeDate + LastTradePriceOnly+ LastTradeTime;  
      +title + desc ; 
    }  
    // Place news stories in div tag  
    document.getElementById( results ).innerHTML = output;    
  }  
</head>
问题回答

检查json_decode();!

$x = json_decode($json_string);         // gives back an array
$x = json_decode($json_string, true);   // gives back an object

事情给我提供了很多帮助......

用途

http://api.jquery.com/jQuery.getJSON/

并且把它放在一个时间上。 如果你将答复(console.log)记录下来的话,你就会看到,你可以背叛你们想要的东西。

这还需要成为有效的 j子,从而确保它与JSON Lint一样:

http://jsonlint.com/

如果是牙齿(认为人们通常会用str子固住有效的 j子),那么你就不得不使用PHP来获得 j子(档案——植被——接触物或CURL),并在服用有效 j子之前ch。





相关问题
Brute-force/DoS prevention in PHP [closed]

I am trying to write a script to prevent brute-force login attempts in a website I m building. The logic goes something like this: User sends login information. Check if username and password is ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

定值美元

如何确认来自正确来源的数字。

Generating a drop down list of timezones with PHP

Most sites need some way to show the dates on the site in the users preferred timezone. Below are two lists that I found and then one method using the built in PHP DateTime class in PHP 5. I need ...

Text as watermarking in PHP

I want to create text as a watermark for an image. the water mark should have the following properties front: Impact color: white opacity: 31% Font style: regular, bold Bevel and Emboss size: 30 ...

How does php cast boolean variables?

How does php cast boolean variables? I was trying to save a boolean value to an array: $result["Users"]["is_login"] = true; but when I use debug the is_login value is blank. and when I do ...

热门标签