Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 02-09-2009, 08:59 PM proxy issue
Novice Talker

Posts: 10
Trades: 0
Hi,

I am using wamp on one of my computer which is using proxy for connecting to internet.

Now when I use php function file_get_contents() I am getting error like:

============================
Warning: file_get_contents() [function.file-get-contents]: php_network_getaddresses: getaddrinfo failed: No such host is known. in d:\****************\test.php on line 2

Warning: file_get_contents(http://www.*********/index.php) [function.file-get-contents]: failed to open stream: php_network_getaddresses: getaddrinfo failed: No such host is known. in d:\****************\test.php on line 2
============================

could anyone let me know how to solve this issue.

thanks
thapame is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 02-10-2009, 03:18 AM Re: proxy issue
tripy's Avatar
Do not try this at home!

Posts: 3,621
Name: Thierry
Location: I'm the uber Spaminator !
Trades: 0
It's because you must first create a context where you explicitly tell PHP that the stream related functions (which file_get_contents is) that they must use a proxy.
Or you should configure your proxy to be transparent, but this is another story.

Look at this comment: http://ch.php.net/file_get_contents#58758
You have a bit of PHP code that explains how to setup such context.
PHP Code:
<?php
// Define a context for HTTP.
$aContext = array(
    
'http' => array(
        
'proxy' => 'tcp://127.0.0.1:8080',
        
'request_fulluri' => True,
        ),
    );
$cxContext stream_context_create($aContext);

// Now all file stream functions can use this context.
$sFile file_get_contents("http://www.php.net"False$cxContext);
echo 
$sFile;
?>
__________________
Only a biker knows why a dog sticks his head out the window.

Last edited by tripy; 02-10-2009 at 03:19 AM..
tripy is offline
Reply With Quote
View Public Profile Visit tripy's homepage!
 
Reply     « Reply to proxy issue
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.10091 seconds with 12 queries