The program under the server will use curl for a network request, ask how to solve the problem of the entire website Card

Source: Internet
Author: User
The program on the server uses curl for a network request. how can I solve the problem of the whole website card? I did not make it clear on the previous post. I will try again. A. phpb. phpc. php three pages. Open the. php page. A. php will use ajax to request B. php. B. php uses curl for data collection. For example, a program on the zhi server will use curl for a network request. how can I solve the problem of the whole website card?
I did not make it clear on the previous post. I will try again.

A. php B. php c. php three pages.

Open the. php page.
A. php will use ajax to request B. php.
B. php uses curl for data collection. For example, zhidao.baidu.com/xx.html
If baidu.com is slow at this time. Curl cannot complete this request quickly. So. The whole website will be stuck. At this time, opening a. php c. php will be stuck there until the ajax request is completed.
How can this problem be solved?

Now I am writing something similar to just reading the functions of the landlord. The mode is similar,
Www.onlylz.com does not seem to have the entire website Card.

------ Solution --------------------
CURLOPT_TIMEOUT, set the timeout time?
Non-blocking?
Http://blog.csdn.net/linvo/article/details/5956629
------ Solution --------------------
The ajax request is complete. It can be set to asynchronous mode.
If you do not have special requirements for data collection, you can regularly collect data and import it to the database. Then
------ Solution --------------------
At this time, opening a. php c. php will be stuck there until the ajax request is completed.
What browser are you using? What server system?

For browsers, each request is irrelevant and there is no saying that only one request can be initiated at a time.
For the server, the resources allocated for each request are independent, and there is no saying that only one request can be processed at the same time.
Therefore, if blocking occurs, it can only be performed by the program, such as the session file lock in PHP.
If session is enabled on the c. php a. php page of your website, other processes on the server will wait until the file lock is released, so the browser will not respond for a long time.
If, as I said, you know the solution.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.