抓取YAHOO股票报价的类_PHP
function getYahooQuote($stockSymbol = "CCR")
{
if (!$targetURL) $targetURL = "http://finance.yahoo.com/q?s=$stockSymbol&d=t"; //设定要抓取的URL目标
$fd = fopen("$targetURL", "r");
$stopExtract = 0;
$startExtract = 0;
while (!feof($fd))
{
$buffer = fgets($fd, 4096);
//echo trim($buffer)."\n";
if (strstr($buffer, "rowspan=3"))
{
//echo "extract started at line #$lineCount\n";
$startExtract = 1;
}
if ($startExtract && !$stopExtract)
{
if (strstr($buffer, "{
$startPos = strrpos($buffer, "$buffer = substr($buffer, $startPos);
}
//$text = trim(strip_tags($buffer));
//echo trim($buffer)."\n";
$buffer = str_replace("\n\r", " ", "$buffer");
if (strstr($buffer, "http://ichart.yahoo.com/v?s=$stockSymbol"))
{
//echo "ichart found!";
$stopExtract = 1;
}
$capturedHTML .= $buffer;
}
if ($startExtract && strstr($buffer, "
"))
{
$stopExtract = 1;
//echo "extract stopped at line #$lineCount\n";
echo $capturedHTML;
break;
}
$lineCount ;
}
fclose($fd);
}
//以下为抓取的一个例子
$symbols = array('CCR', 'IIXL','SAPE','WBVN' );
$symbolCount = count($symbols);
for ($i=0; $i{
echo "$symbols[$i]
";
getYahooQuote("$symbols[$i]");
}
?>

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



In this article, we will learn the best way to get stock data using Python. The yfinancePython library will be used to retrieve current and historical stock market price data from Yahoo Finance. Install Yahoo Finance (yfinance) One of the best platforms to get stock market data is Yahoo Finance. Simply download the dataset from the Yahoo Finance website and use the yfinance library and Python programming to access it. You can install yfinance with the help of pip, all you have to do is open the command prompt and type the following command to show the syntax: Syntax pipinstallyfinance The best part about the yfinance library is that it is free to use and does not require an API key like

Yahoo is Yahoo, a well-known Internet portal in the United States. Its services include search engines, emails, news, etc. Its business covers 24 countries and regions, providing diversified network services to more than 500 million independent users around the world; it is also a global Internet communications, commerce and media company. Yahoo has 12 language versions including English, Chinese, Japanese, Korean, French, German, Italian, Spanish, and Danish. The content of each version is different from each other; it provides directory, website and full-text search functions.

The stock market has always been a topic of great concern. The daily rise, fall and changes in stocks directly affect investors' decisions. If you want to understand the latest developments in the stock market, you need to obtain and analyze stock information in a timely manner. The traditional method is to manually open major financial websites to view stock data one by one. This method is obviously too cumbersome and inefficient. At this time, crawlers have become a very efficient and automated solution. Next, we will demonstrate how to use PHP to write a simple stock crawler program to obtain stock data. allow

As an all-in-one IP ecological operator, Tomcat has recently made important progress in the field of artificial intelligence. The AI Tom Cat product cooperated with Xihu Xinchen has passed the registration and officially started closed testing on August 27. This product has multiple functions such as photo recognition, English speaking enlightenment, interest guidance, popular science education, AI generated pictures, AI generated picture books, situational dialogue, etc. 123 Finance believes that this move will further expand Tom Cat’s IP ecosystem and provide users with a more intelligent and interactive experience. The Xihu Xinchen team that cooperates with Tom Cat is a top domestic AI technology team with more than 60 people. The team has extensive experience in the field of artificial intelligence and has successfully developed "ALBERT", a lightweight version of Google's large model BERT. he

Microsoft previously officially released the new win11 system at a press conference, which caused its stock price to rise significantly. Therefore, many domestic investors want to take advantage of this craze to see which other stocks will benefit. Let’s take a look with the editor. Which stocks will benefit from Microsoft’s win11 conference: 1. Microsoft. 1. Microsoft’s win11 conference will naturally benefit its own stock. 2. According to relevant performance, Microsoft’s stock price rose to US$259.89 after the press conference, an increase of 0.78%. 3. In addition, according to the forecast maintained by Mike Peak, the target price of Microsoft's stock price is US$301, so there is still a lot of room for growth. 2. Huiguan Co., Ltd. 1. Huiguan Co., Ltd. is one of the touch screen suppliers of Lenovo Computer and has obtained the Microsoft Lo

According to documents released by the U.S. Securities and Exchange Commission (SEC), this site learned that Mark Zuckerberg sold Meta stock almost every day in December. As of November 29, he had sold a total of 560,180 shares. A form filed with the SEC on November 30 showed that he planned to sell an additional 28,009 shares of Meta stock. Based on the closing price of the day ($327.15), the total value of these stocks is approximately $192.90 million (note on this site: currently approximately 1.377 billion yuan). It is worth mentioning that the MetaPlatforms shares sold this time are indirectly owned by Zuckerberg through various funds. The entire disclosure of sales and other processes also complies with the 10b5-1 trading rules set by the SEC.

According to news from this site on August 5, Yonhap News Agency reported that due to the adverse impact of the deterioration of U.S. economic indicators, the Korea Composite Stock Price Index (KOSPI, calculated by the prices of all stocks traded on Korean exchanges) fell below 2,500 points on the 5th. . Among the stocks listed on KOSPI, 98% fell. As of the publication of this article, the Korea Composite Stock Price Index (KOSPI) was 2441.33, a decrease of 8.78%. Samsung Electronics' stock price fell by more than 10%, its largest decline since 2008. Previously, its largest union, NSEU, called on members to return to work, but said the strike would continue for a long time. In addition, all the top 200 stocks by market capitalization showed a downward trend. SK Hynix (-9.53%), Hyundai Motor (-8.40%), Kia (

Virtual currencies and stocks are two completely different investment categories. Stocks represent ownership of listed companies, while virtual currencies are decentralized and unregulated digital assets. It is crucial to understand the key differences between virtual currency trading and stock trading in order to make informed investment decisions.
