You can't get web content with PHP, but you can access Web content in a browser, what's the situation? What to do with it

Source: Internet
Author: User
You can't get web content with PHP, but you can access Web content in a browser, what's the situation?
This post was last edited by u013067065 on 2014-01-03 13:46:46

Let's just infer from the facts what the problem is.
1. The server can use the browser to access the target Web page normally
2, the same URL with PHP can not access the content of the page.

Test code:


$a = file_get_contents (' destination URL ');
Var_dump ($a);
?>


The results are as follows:



Clearer Picture: http://www.daimami.com/img/2014/01/07/222915183.jpg

No matter what, always get a section of JS. This section of JS seems to be responsible for steering.



And this code seems to be dynamic, each time the function name variable name will change itself dynamically, it should be some kind of software generated automatically.


3, the same program code, other servers can normally get to the destination URL of the page content.

According to the above facts, then you can infer where the problem is?

What are the restrictions on the target site for the server? Or is it a server configuration issue? Ask for answers!

share to: more


------Solution--------------------
JS code is to run after the results will be
You only get the JS code, but not run, how can I get results?

  • Related Article

    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.