php用htaccess密码写一个网址?

时间:2012-07-31 15:31:19

标签: php fread http-status-code-401

  

可能重复:
  mysql_fetch_array() expects parameter 1 to be resource, boolean given in select

$handle = fopen(site_url() . "/?post_type=tab_content&p=$content_id&_parent_id=$parent_id&_page_id=$page_id", "r");
$contents = fread($handle, filesize($filename));
fclose($handle);

给了我:

Warning: fopen(http://dev.yoursite.com/website/?post_type=tab_content&p=424&_parent_id=92&_page_id=110): failed to open stream: HTTP request failed! HTTP/1.1 401 Authorization Required in /var/www/domains/dev/website/wp-content/themes/insource/index.php on line 82 Warning: fread() expects parameter 1 to be resource, boolean given in /var/www/domains/dev/website/wp-content/themes/insource/index.php on line 83 Warning: fclose() expects parameter 1 to be resource, boolean given in /var/www/domains/dev/website/wp-content/themes/insource/index.php on line 84

这是我可以用PHP绕过的东西吗?非常感谢 -

2 个答案:

答案 0 :(得分:2)

您可以尝试输入内联用户名和密码,如下所示:

http://username:password@dev.yoursite.com/website/?post_type=tab_content&p=424&_parent_id=92&_page_id=110

应该适用于基本的http身份验证

答案 1 :(得分:2)

您应该能够提供用户名和密码作为URL字符串的一部分,就像使用FTP连接一样:

http://username:password@url.com/path/