Jump to content

Recommended Posts

i want to use a http proxy to connect to the internet via php

<?php
  $context = stream_context_create(
    array('http'=>
      array('proxy'=>'http://proxy.example.com:5100')
    ));

  $contents = file_get_contents('http://www.somesite.com/pat/to/file',
false, $context);
?>

this is all what i need except that it gives the following error

 

Unable to find the socket transport "http" - did you forget to enable it when you configured PHP?

 

but i want to use a proxy every time i connect to the internet

for example i want to use http://magpierss.sourceforge.net/ via a proxy

 

moreover i want to use a socks proxy along with mail function to bypass my ISP's firewall which blocks port 25

Link to comment
https://forums.phpfreaks.com/topic/84696-php-and-proxy/
Share on other sites

I may be wrong here, but do you mean

 

fopen("URL", "r", false $context);

 

Then you need to fix your $context to be something like:

$context = stream_context_create(

array('http'=>

    array('method'=> "POST"

            'header' => "SOME HEADER HERE"));

 

It's like cURL, which I'm not an expert at. :(

Link to comment
https://forums.phpfreaks.com/topic/84696-php-and-proxy/#findComment-432621
Share on other sites

well my problem is that i want to acess the internet through PHP(which is executed through apache on local computer) and php should connect to internet through a proxy server

i need a configuration in php.ini(or some thing like that) which does the exact work of CURLOPT_PROXY in cURL

Link to comment
https://forums.phpfreaks.com/topic/84696-php-and-proxy/#findComment-432624
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.