S
S
sandrain2014-04-02 12:01:44
PHP
sandrain, 2014-04-02 12:01:44

PHP - how to fetch content from a web server on a local network?

The question is next.
There is a local address on the network http://192.168.1.38/mypage
There is an Apache and gives the page.
It opens through a browser.
But it doesn't ping and you can't retrieve data from this address via file_get_contents.
Tell me how to be?
UPD:
it worked through CURL, I can pick up the content ..
but when I try to make a SOAP request to this IP and it says could not connect to host, although it works from the computer to which I am making the request (even if you specify not 127.0.0.1 but this ip)

Answer the question

In order to leave comments, you need to log in

3 answer(s)
M
MrButek, 2014-04-02
@MrButek

Maybe your PHP configuration says allow_url_fopen = 0, which is why file_get_contents doesn't work.

A
Alexander Karabanov, 2014-04-02
@karabanov

Doesn't ping, probably because the firewall drops ICMP packets. And with the help of file_get_contents, the page can not be taken away because there is some kind of protection against bots. Use cURL to mimic how a browser works.

T
tushev, 2014-04-02
@tushev

First, make sure that file_get_contents is generally able to get data from at least some address. Then figure out why you can't pick up from 192.168.1.38/mypage.
Maybe there are firewalls between php and 192.168.1.38. Try to read the data not through php, but through some kind of command line utility from the php side.
Probably on that party headings of request are checked. In addition to the user-agent, stuff all the other browser headers in general (intercept them to understand what they are there).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question