This code always has a 504ProxyTimeout error about 2 MB. why? -Php Tutorial

Source: Internet
Author: User
This code always has a 504ProxyTimeout error about 2 MB. why? When $ fucknum is large, for example, 1000, the 504 Proxy Timeout error will occur, and the program will not continue to run after the error is reported, as if it has stopped, $ the fucknum value is less than an hour. why? Please advise
Function autonewnewegg ($ arr) {$ fucknum = intval ($ arr ['fucknum']); // # obtain the integer of the number of captured entries $ outime = $ fucknum * 2 + 100; set_time_limit ($ outime); // Set the script execution time $ nextnum = 20; // terminate when 10 consecutive searches do not exist $ sn = $ arr ['SN ']; $ acl = explode ("-", $ sn); $ acl_1 = preg_replace ('/[^ 0-9] +/', ', $ acl [1]); // second $ a = $ B = 0; // second while ($ fucknum> 0) {$ arr1 = $ arr2 = array (); if ($ acl [2] <1000 & $ acl_1 <100) {$ acl [2] = str_pad ("$ acl [2]", 3, '0 ', STR_PAD_LEFT); $ acl_1 = str _ Pad ("$ acl_1", 2, '0', STR_PAD_LEFT); $ acl [1] = "c ". $ acl_1; $ arr_in = implode ("-", $ acl); then '; if ($ acl [2] = 999) {$ acl_1 = $ acl_1 + 1; $ acl [2] = 001;} else {++ $ acl [2];} elseif ($ acl [0] <= 99) {$ acl [0] = str_pad ("$ acl [0]", 2, '0', STR_PAD_LEFT); $ arr_in = implode ("-", $ acl ); $ acl [2] = 001; $ acl_1 = 01; ++ $ acl [0]; your url1_1_globals1_'competitor'{1}'product'{.}arr_in.'.htm ';} $ Str = file_get_contents ($ url); if (! $ Str) {$ fucknum --;} else {$ preg = '/href = "http: \/www \. newegg \. com \. cn \/SubCategory \/(\ d *)\. htm ">/'; $ preg2 = '/(. *) <\/h1>/'; $ str = iconv ("gbk", "UTF-8", $ str); preg_match ($ preg, $ str, $ arr1 ); preg_match ($ preg2, $ str, $ arr2); if (empty ($ arr1) | empty ($ arr2) {$ fucknum --;} else {$ price = $ this-> ocr_newegg ($ url); if ($ price = false | $ price = '. ') {$ price = $ this-> ocr_newegg1 ($ url);} if ($ price = false) {} else {$ autoarr = array ('CID' => $ arr1 [1], 'Name _ newegg '=> $ arr2 [1], 'Price _ newegg '=> $ price, 'SN _ newegg' => $ arr_in); $ this-> addnew_newegg ($ autoarr);} $ fucknum --;}}} return true ;}


Reply to discussion (solution)

Timeout.
Set_time_limit (0 );
?

Make the script never time out: set_time_limit (0 );

Timeout.
Set_time_limit (0 );
?
We have already set $ outime to dynamically change according to $ fucknum. why not time out when there is a small amount of data,
Set_time_limit ($ outime); // you can specify the script execution time.

Let the script never time out: set_time_limit (0); if it is set, the error will still appear, not for this reason.

Report: The cause of 504 Proxy Timeout is probably
After receiving an access request from the client from the internal network adapter, the external network adapter immediately forwards the request to the destination website server at the same time, but the destination website server does not respond in time. Resend the request after 3 seconds, and resend the request after 6 seconds. The Nic has to return the request to the client HTTP/1.1 504 Proxy Timeout because it has not received the response.

Report: The cause of 504 Proxy Timeout is probably
After receiving an access request from the client from the internal network adapter, the external network adapter immediately forwards the request to the destination website server at the same time, but the destination website server does not respond in time. Resend the request after 3 seconds, and resend the request after 6 seconds. The Nic has to return the request to the client HTTP/1.1 504 Proxy Timeout because it has not received the response. Is there a limit on file_get_contents websites?

Reference the reply from heyc1998 on the fifth floor:

Report: The cause of 504 Proxy Timeout is probably
After receiving an access request from the client from the internal network adapter, the external network adapter immediately forwards the request to the destination website server at the same time, but the destination website server does not respond in time. Resend the request after 3 seconds, and resend the request after 6 seconds. The Nic has to return the request to the client HTTP/1.1 504 Proxy Timeout because it has not received the response.
Is it file_get_con ......

You can sleep for a long time after each loop to see if such a phenomenon still exists !~ It should be a remote server problem!

Reference the reply from helloqhq on the 6th floor:

Reference the reply from heyc1998 on the fifth floor:

Report: The cause of 504 Proxy Timeout is probably
After receiving an access request from the client from the internal network adapter, the external network adapter immediately forwards the request to the destination website server at the same time, but the destination website server does not respond in time. Resend the IP address once 3 seconds later and resend the IP address again 6 seconds later. The Nic has to return HTTP/1.1 504 Proxy Ti to the client because it has not received the response ...... After the 504 Proxy Timeout error is reported, the loop continues to run. now the program has a problem after the error is reported, as if the while loop cannot end and true is not returned.

Reference the reply from helloqhq on the 6th floor:

Reference the reply from heyc1998 on the fifth floor:

Report: The cause of 504 Proxy Timeout is probably
After receiving an access request from the client from the internal network adapter, the external network adapter immediately forwards the request to the destination website server at the same time, but the destination website server does not respond in time. Resend the IP address once 3 seconds later and resend the IP address again 6 seconds later. The Nic has to return HTTP/1.1 504 Proxy Ti to the client because it has not received the response ...... That is to say, this error has a return value. how can we block this return value?

Reference the reply from helloqhq on the 6th floor:

Reference the reply from heyc1998 on the fifth floor:

Report: The cause of 504 Proxy Timeout is probably
After receiving an access request from the client from the internal network adapter, the external network adapter immediately forwards the request to the destination website server at the same time, but the destination website server does not respond in time. Resend the IP address once 3 seconds later and resend the IP address again 6 seconds later. The Nic has to return HTTP/1.1 504 Proxy Ti to the client because it has not received the response ...... I have two dead posts. I can reply to them as soon as possible.
Http://topic.csdn.net/u/20101128/19/0fedb777-1901-4460-945b-ddc2a8787ba0.html
Http://topic.csdn.net/u/20101209/17/438c616b-3132-41bc-a329-86f84e46a72c.html

I also encountered this problem. The background is not over, and the foreground times out. is the problem solved by the primary account?

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.