0
$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);

gives me:

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

Is this something I can bypass with php? Many thanks-

Dharman
  • 30,962
  • 25
  • 85
  • 135
Jacksonkr
  • 31,583
  • 39
  • 180
  • 284

2 Answers2

2

You could try to put inline username and password like this:

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

which should work for the basic http authentication

Matteo Tassinari
  • 18,121
  • 8
  • 60
  • 81
2

You should be able to supply the username and password as part of the URL string, much like with FTP connections:

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

Patrick Moore
  • 13,251
  • 5
  • 38
  • 63