Click to See Complete Forum and Search --> : Getting around a proxy


LordShryku
09-29-2003, 07:53 PM
Yeah, that looks like a custom function planetsim. Really needs some comments :p

Here's one I wrote to get around my proxy a while ago when pulling the slashdot RSS feed. It was a quick and dirty script, so i'm sure someone can make it better. Any ideas?

<?
function damnProxy($page, $proxyHost, $proxyPort) {
$data = fsockopen($proxyHost, $proxyPort);
if(!$data) {
fclose($result);
echo "Cannot access ".$page;
}
else {
fputs($data,"GET $page HTTP/1.0\n\n");
while(!feof($data)) {
$cont=$cont.fread($data,4096);
}
}
fclose($data);
return substr($cont,strpos($cont,"\r\n\r\n")+4);
}

$slash = damnProxy("http://slashdot.org/slashdot.rdf", "proxy.yourcompany.com", 8080);
if($slash) {
echo $slash;
}
else {
echo "damned proxy";
}
?>

jstarkey
09-29-2003, 07:59 PM
Dear Lord, ;)

I split your thread so that it doesn't get lost in thee hussle.

planetsim
09-29-2003, 08:02 PM
Nice script there.. may come to use for many now as RSS feeds are becoming more popular

Merve
09-29-2003, 08:04 PM
What the hell's an RSS feed?

planetsim
09-29-2003, 08:08 PM
Maybe this may help you

http://searchwebservices.techtarget.com/sDefinition/0,,sid26_gci813358,00.html

jstarkey
09-29-2003, 08:14 PM
We also have an RSS feed for the forums and articles here.

http://phpbuilder.com/linking.php

Merve
09-29-2003, 08:18 PM
Thanks!

LordShryku
09-29-2003, 09:40 PM
Man, just found my post. Thought jstarkey deleted it :p

So, that one just get's around the proxy. I got a class that parses the RDF file for me if anyone wants to see that also, I can post it tomorrow. I tried getting phpbuilder's feed, but didnt have much luck. Might need to try again sometime.

BTW....sorry for the lack of comments in the code, but I just never comment my code. Drawback from being the only coder at work I guess.

drawmack
09-29-2003, 09:57 PM
I started commenting when a client called me 18 months after originally programming his site for some changes.

LordShryku
09-29-2003, 09:59 PM
I'm sure I'd be commenting if I was selling my work, but I work for one company, doing internal apps. If I go, that means I'm fired. And screw em in that case :D

drawmack
09-29-2003, 10:55 PM
Lord, I understand your point but what about when they want a revision to something you wrote two years ago. When that happens, you'll probably start commenting.

LordShryku
09-29-2003, 11:01 PM
Most of my stuff is pretty straight forward. Pull the info from the database. Display it. Not too much deviation. But yeah, I've been thinking for a while now that I need to adopt some sort of commenting standard. I just don;t find a need for it a lot. But you're right. No rebuttal needed. I know it

n00854180t
09-30-2003, 02:10 PM
Comments are a pain for me too. I appreciate them when they are there, but when I have a very limited time frame I tend to slack on using them.

planetsim
09-30-2003, 06:57 PM
hmm.. i only tend to comment on complicated scripts.. which i will be modifying. If i know its not going to be modified i probably wouldnt waste my time but i guess its always a good idea..

Merve
09-30-2003, 09:00 PM
Yeah, I'd better comment and indent and improve and use better functions and shorten and add to my old calculator script. It's the second one I ever made. (First was MadLib, second was calculator, third was send me a message and that needs improving)

damn I need to improve all my scripts!

LordShryku
09-30-2003, 09:05 PM
Well post em up here :)

Merve
09-30-2003, 09:06 PM
I'll post them after I've made the necessary changes/other modifications.

dougmcc1
12-28-2005, 07:12 PM
This is an amazing script, I can't thank you enough. Thanks for coming through yet again.