Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length

 
Advanced search

879886 Posts in 33010 Topics- by 24383 Members - Latest Member: celloe

May 25, 2013, 07:27:12 AM
TIGSource ForumsDeveloperTechnical (Moderators: Glaiel-Gamer, ThemsAllTook)Test PHP proxy locally
Pages: [1]
Print
Author Topic: Test PHP proxy locally  (Read 570 times)
Sean A.
Level 7
**



View Profile Email
« on: February 01, 2012, 03:59:32 PM »

So i am creating an application in flash that downloads the weather as an XML file from googles weather service. Because google doesn't have a crossdomain file I need to use a proxy to bypass the security. I'm not familiar with PHP but I looked it up and got many different results but when I try to test it locally I get a null response. I'm not sure if this is because I am testing it locally and not on a website or there is a problem with the script I am using. Here are the two methods I've tried and they both give me blank results but no error. So the question is if there is a way to test the proxy locally without uploading everything to the site (because I dont have direct access).
Code:
<?php
$url 
$_GET['targetURL'];
readfile($url);
?>
Code:
<?php
$url $_GET['targetURL'];
header('Content-Type: text/xml');
readfile($url);
?>
Logged
agersant
Level 3
***



View Profile WWW Email
« Reply #1 on: February 01, 2012, 05:28:14 PM »

Is PHP running on your machine ? If not, you might want to take a look at WAMP. You cannot just write a php script and open it in your browser.
Logged

xerus
Vice President of Marketing, Romeo Pie Software
Level 10
*


kpulv

Storm+X+MH
View Profile WWW
« Reply #2 on: February 01, 2012, 06:09:03 PM »

Is PHP running on your machine ? If not, you might want to take a look at WAMP. You cannot just write a php script and open it in your browser.

Whoa this WAMP stuff looks awesome.  I've been using xampp for my local web server stuff.  I wonder how this compares!  Wizard
Logged

Sean A.
Level 7
**



View Profile Email
« Reply #3 on: February 01, 2012, 07:25:49 PM »

Well I am using a mac for development but will there be any other issues testing this thing locally?

Edit: So I found out that OSX has some built in stuff for web development, you just have to enable php so I'm working on that now

Edit: Just figured it out and the proxy worked, thanks for the help  Beer!
« Last Edit: February 01, 2012, 08:12:04 PM by Sean A. » Logged
Richard Kain
Level 10
*****



View Profile WWW Email
« Reply #4 on: February 01, 2012, 08:52:10 PM »

Yeah, having a development web environment to work off of is a real blessing. At my place I've rigged up a Ubuntu box as my local webserver, and all the other machines in the house feed into it for DNS. Not only can I test server-side scripts on it, but I can define my own domain names. They only apply locally, but it is fantastic for testing on different machines.
Logged
Sean A.
Level 7
**



View Profile Email
« Reply #5 on: February 01, 2012, 10:06:00 PM »

That's awesome! Having it built right into the os is the best. It was pretty finicky trying to enable it but once I did it has been great.
Logged
st33d
Guest
« Reply #6 on: February 02, 2012, 03:06:55 AM »

Second WAMP for XP, I'm currently using it to test the Facebook API (which crashes if you try to run it locally).
Logged
Sean A.
Level 7
**



View Profile Email
« Reply #7 on: February 02, 2012, 02:17:38 PM »

I've been having some weird problems trying to create HTML files. I copied some sample HTML code and pasted it in a text editor and saved as .html file but it wouldn't render the file correctly in browser, it just displayed the code. Then I pasted it in dreamweaver and saved it and that rendered it properly. I found it a little odd.
Logged
JMickle
Level 10
*****


lqikq come home


View Profile
« Reply #8 on: February 02, 2012, 04:16:52 PM »

you have to make sure its not saving as text
Logged

Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic