How to use proxy with PHP?

Hi,

I want to develop a php program to get information from the website and store them in the local database. The difficulties here is that I am in the internal web, and the machine host my program can only access the internet by proxy. So how can I use php programming to access the internet through the proxy server?

Thank you.
mryyzxAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

hernst42Commented:
That will only work with the curl-module. Via the normal PHP-function like fopen fget_content, ..there is no support for proxy. For curl see http://de3.php.net/manual/en/ref.curl.php
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
andYetAnotherLoginNameCommented:
on the contrary, you can do whatever you'd like. use fsockopen to negotiate your proxy.

you'll basically need something like this:
$fp = fsockopen ("proxe.server.here", 80, $errno, $errstr, 30);
if (!$fp) {
    echo "$errstr ($errno)<br>\n";
} else {
    fputs ($fp, "GET http://needed.server.here/file.ext HTTP/1.0\r\n\r\n");
    while (!feof($fp)) {
        echo fgets ($fp,128);
    }
    fclose ($fp);
}
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.