Paid Advertising is
ha.ckers sla.cking
Bug reports, feature enhancements or other complaints with the site, with us or just tell us what a miserable existance you have. No death threats or poetry please. Just kidding, no poetry please. 
Go to Topic: PreviousNext
Go to: Forum ListMessage ListNew TopicSearchLog In
proxy authentication problem
Posted by: peeyushgulati
Date: March 03, 2008 07:17AM

Hi every1

I was trying to create a mashup using some available API like yahoomaps, google and all.

For instance if i run this code to fetch the latitude and longitude of a place using goole API.


$key = "YOUR_KEY_HERE";

$address= ",+Columbus,+OH&output=xml&key=$key";

$page = file_get_contents($address);

$xml = new SimpleXMLElement($page);

echo $xml->Response->Placemark->Point->coordinates;


this runs perfectly at my personal network but if i need to run it in a organizational network then it will not fetch the contents as it doesnt passes through the proxy which is a mandate.

Can some one suggest ?

Peeyush Gulti

Options: ReplyQuote
Re: proxy authentication problem
Posted by: Malkav
Date: March 03, 2008 08:34AM

i didn't understood the question. slow mondays and everything.

is your proxy a reverse proxy such as varnish (loadbalancer, accelerator for servers) or a forward one like squid for user authentication, traffic filtering and such ?

secundo, of which content are you talking about? gmaps data ? client data ? gmaps data should be handled internally and would not have to see the same reverse proxy as the server, instead escaping by a secondary route. client data is part of the same session on the reverse, so i don't see where could be the problem

i don't see any legitimate scenario where you would have to serve such content through a user forward proxy. but perhaps this is a really *slow* monday


Those that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.
--Benjamin Franklin

Options: ReplyQuote
Re: proxy authentication problem
Posted by: Matt Presson
Date: March 28, 2008 05:01PM

@Peeyush -
The easier way would be to use curl to get the response. You could then set your proxy fairly easily. Here is an example:


$URL = ",+Columbus,+OH&output=xml&key=$key";

// Get a curl handle
$ch = curl_init();

// Set various curl options
curl_setopt($ch, CURLOPT_PROXY, "http://<proxy_host>:<proxy_port>");
curl_setopt($ch, CURLOPT_URL, $URL);
curl_setopt($ch, CURLOPT_GET, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 5);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_FRESH_CONNECT, true);

$ret = curl_exec($ch);

// Parse the response from the big G



Options: ReplyQuote

Sorry, only registered users may post in this forum.