Hello.

Such a problem: on LAN everything is fine, as soon as I transfer the hosting server to the hosting server, the router stops responding. That is, for example, if checked via cURL:

function isUp($url) { if(!filter_var($url, FILTER_VALIDATE_URL)) { return false; } $curlInit = curl_init($url); curl_setopt($curlInit,CURLOPT_CONNECTTIMEOUT,10); curl_setopt($curlInit,CURLOPT_HEADER,true); curl_setopt($curlInit,CURLOPT_NOBODY,true); curl_setopt($curlInit,CURLOPT_RETURNTRANSFER,true); $response = curl_exec($curlInit); curl_close($curlInit); if($response) { return true; } return false; } 

This returns FALSE. Further, if you remove the check, it simply does not display anything.

 $page_content = file_get_contents('http://rutor.org/'); $html = phpQuery::newDocument($page_content); foreach($html->find('#index .tum, .gai') as $key => $value) { $result[$key]['date'] = pq($value)->find('td:eq(0)')->text(); } 

Tried through cURL, replace the referrer, put USER_AGENT, nothing helps.

What could be the problem? I repeat, everything works great on LAN. Thank you in advance.

    2 answers 2

    Security policy of the server where the hosting is located. Have you already talked to your hosting support?

    If everything is fine on your local machine, then everything will be fine with us ... And from local machines and hosting sites without curl restrictions, how can we help you? You are waiting for the phrase: "Everything works with us. Hands just need to be sharpened correctly."?


    Add to the beginning of the script:

     ini_set('display_errors',1); error_reporting(E_ALL); 

    Check server logs if available. Use other debugging tools.

    What specifically and in what line does not work, you can specify?

    • @LTKN, Everything, figured out, thanks. The mistake was really on my part. Thanks for the tip! - evansive pm
    • one
      @evansive, you excuse me for being a little harsh. Recently, there has been a bad trend - the lack of a clear question wording. It seems: "here's the code, what's wrong with it? It worked before." I understood very well from my own practice that 80% of the answer is a well-asked question. And if you chew a question to a person far from the project, sometimes you don’t have time to agree, as you understand your mistake. Good luck on the code pages. Do not forget that you should not fully rely on someone else's content, all of a sudden, the owners will think about changing the design or the paths to the pages ... - LTKH

    before

     curl_close($curlInit); 

    write:

     echo '<pre>'.print_r(curl_getinfo($curlInit), 1).'</pre>'; 

    well, or output somewhere in the log.

    • @shurik, here is the output: pastebin.com/JHdQ3SVL By the way, those. support replied that for its part does not restrict access. - evansive