fsockopen и Moved Permanently , что значит ошибка?

DenVic

Новичок
fsockopen и Moved Permanently , что значит ошибка?

Здравствуйте все. Такая проблемка есть:
PHP:
$host = 'xxxx.den.ru';
PHP:
$fp = @fsockopen ("$host", 80, $errno, $errstr, 10);
PHP:
if (!$fp) {
PHP:
echo "$errstr ($errno)<br>\n";
PHP:
} else {
PHP:
fputs($fp, ....);
PHP:
.....
PHP:
while (!feof($fp)) {
PHP:
$content .= fgets($fp, 4096);
PHP:
}
PHP:
echo $content;
PHP:
}
PHP:
fclose($fp);
при выполнении выдает шибку:
HTTP/1.1 301 Moved Permanently Location: https://xxxx.den.ru/bad/control Cache-control: private Content-Length: 0 Date: Wed, 12 Oct 2005 17:48:23 GMT Content-Type: text/html Server: GFE/1.3
 

DenVic

Новичок
наскоко я понял это ошибка связано как-то постоянным изменением URI по которому обращается сокет:

301 Moved Permanently
The requested resource has been assigned a new permanent URI and any future references to this resource SHOULD use one of the returned URIs. Clients with link editing capabilities ought to automatically re-link references to the Request-URI to one or more of the new references returned by the server, where possible. This response is cacheable unless indicated otherwise.

The new permanent URI SHOULD be given by the Location field in the response. Unless the request method was HEAD, the entity of the response SHOULD contain a short hypertext note with a hyperlink to the new URI(s).

If the 301 status code is received in response to a request other than GET or HEAD, the user agent MUST NOT automatically redirect the request unless it can be confirmed by the user, since this might change the conditions under which the request was issued.

Note: When automatically redirecting a POST request after
receiving a 301 status code, some existing HTTP/1.0 user agents
will erroneously change it into a GET request.

что-то я тут несовсем понял, растолкуйте как понять. И что сделать чтоб такой не было кто знат?
 

Andreika

"PHP for nubies" reader
DenVic
перевести не переведу (обратись к translate.ru), но смысл такой - тебе намекают, что искомая страничка переехала и в лудшем случае тебе надо переделать скрипт с новым адресом (указанным в Location ответа) или повторить запрос еще раз на новый же адрес
 

DenVic

Новичок
весь прикол-то в том, что новый адрес совпадает со старым :) Наверное сдесь защита какаято стоит, а вот как ее обойти...
в этом тексте ты где-то видишь слово "ошибка?"
ошибку не вижу, имеется в виду что скрипт не работает и по пусту нечего писать (если нет мыслей )
 

DenVic

Новичок
абсолютно индентичны нвый и старый адреса, совпадает все
Как предлположение: обязательно ли coockies посылать в запросе? (у меня его нет)
 

tony2001

TeaM PHPClub
$fp = @fsockopen ("$host", 80, $errno, $errstr, 10);

и

https://xxxx.den.ru/bad/control

суть разные вещи.
 

DenVic

Новичок
$fp = @fsockopen ("$host", 443, $errno, $errstr, 10);
...
echo $content;

зато теперь вообще ничего не выводит (чист как белый снег):)
 

SiMM

Новичок
Убери собаку нафиг + смотри, что возвращается в $errstr
В общем, фдибаг.
 

DenVic

Новичок
$fp = fsockopen ("$host", 443, $errno, $errstr, 10);
...
echo $content;
теперь вообще ничего не выводит (чист как белый снег)
(это правильнее будет , sorry за@ опечатался)
 
Сверху