Jump to content


Photo

fopen, file, readfile all 403d


  • Please log in to reply
3 replies to this topic

#1 johnnyk

johnnyk
  • Members
  • PipPipPip
  • Advanced Member
  • 126 posts

Posted 25 February 2006 - 07:55 PM

Warning: fopen(http://en.wikipedia.org/wiki/PHP): failed to open stream: HTTP request failed! HTTP/1.0 403 Forbidden in wikipedia.html on line 16

Why is it 403ing? Is there anyway to analyze wikipedia page with php?
Rediscover the Web:
<a href="http://www.spreadfir...;t=219"></a><br />

#2 johnnyk

johnnyk
  • Members
  • PipPipPip
  • Advanced Member
  • 126 posts

Posted 25 February 2006 - 10:04 PM

I heard fsockopen would stop the 403, but I tried it out and it won't make a connection at all. At least I don't think it makes a connection cause the script aint working.
Rediscover the Web:
<a href="http://www.spreadfir...;t=219"></a><br />

#3 johnnyk

johnnyk
  • Members
  • PipPipPip
  • Advanced Member
  • 126 posts

Posted 26 February 2006 - 01:44 AM

Edit: Forget it, post name confusing, started other post
Rediscover the Web:
<a href="http://www.spreadfir...;t=219"></a><br />

#4 hitman6003

hitman6003
  • Members
  • PipPipPip
  • Advanced Member
  • 1,807 posts

Posted 26 February 2006 - 03:59 AM

This will get you started.

You will need to make sure that the cURL extension is enabled.

$page = "http://en.wikipedia.org/wiki/PHP";

function processURL($url){
       $url=str_replace('&amp;','&',$url);
       $ch=curl_init();
       curl_setopt($ch, CURLOPT_URL, $url);
       curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
       $xml = curl_exec ($ch);
       curl_close ($ch);
       echo $xml;
}

echo processURL($page);

Read the manual pages on cURL as well:

[a href=\"http://www.php.net/curl\" target=\"_blank\"]http://www.php.net/curl[/a]




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users