Problem with the proxy settings

Problems with the Windows version of XAMPP, questions, comments, and anything related.

Problem with the proxy settings

Postby Fujisan » 19. November 2008 08:26

I am using XAMPP for Windows.

I am trying to read a remote document like below:

Code: Select all
<?php
readfile("some url");
?>


It works perfect if I have the direct internet connection. However, when I use a connection with proxy, the following error message appears:

Code: Select all
Warning: readfile() [function.readfile]: php_network_getaddresses: gethostbyname failed in...


I set apache like below:

in c:\xampp\apache\conf\httpd.conf

uncommented lines
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule proxy_html_module modules/mod_proxy_html.so

in c:\xampp\apache\bin\php.ini

; Default proxy IP address (if required).
pfpro.proxyaddress = 100.99.98.97:8080

restarted the Apache.

But it still doesn't work.

What I did wrong?

Thanks for any advice.
Fujisan
 
Posts: 2
Joined: 19. November 2008 08:05

Postby Wiedmann » 19. November 2008 08:43

readfile("some url"); ... when I use a connection with proxy, the following error message appears:

This does only work, if you are using a context stream resource in readfile() and setting the correct HTTP context option for proxy usage.

I set apache like below:

This problem have nothing to do with mod_proxy in Apache or the Verisign Payflow Pro extension in PHP.
Wiedmann
AF Moderator
 
Posts: 17102
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Postby Fujisan » 19. November 2008 09:46

Thank you for quick reply!

Finaly I get the working code:
Code: Select all
<?php

$opts = array('http' => array('proxy' => 'tcp://199.98.97.96:8080', 'request_fulluri' => True));

$context = stream_context_create($opts);

echo file_get_contents("http://...my url.../index.html", False, $context);

?>
Fujisan
 
Posts: 2
Joined: 19. November 2008 08:05


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 146 guests