Jump to content


  • Posts

  • Joined

  • Last visited

jbach's Achievements


Enthusiast (6/14)

  • First Post
  • Collaborator
  • Conversation Starter
  • Week One Done
  • One Month Later

Recent Badges



  1. Ok, thanks I've been trying to get a web application that needs a php url proxy to work with another server. (its for a Twitter application) Could you confirm or deny that I am able to use php proxy scripts on TotalChoice? Spent the last week trying to troubleshoot this...
  2. Hi Using a php proxy script to intercept all calls between a web aplication and the destination server. Trying to resolve a pesky '403 forbidden' error I get on the destination server. Came across this post o stackoverflow http://stackoverflow.com/questions/1300125/php-script-403-forbidden-error Is it possible, in order to execute properly, I need to make my php script a member of the httpd group?? If so, how do I do this? to summarize ...Generally, 403 means that the web server doesn't have the rights to read the file and therefore can't continue the request. The permissions may be set correctly, however the file might be owned by another account on the server - an account that isn't part of the same group as the account which is running the server. For instance, I believe* Apache is ran by default under the httpd user account, which is part of the httpd group. However, the FTP user you're logging in as (for instance ftpuser) might not be part of the httpd group. So, in copying the file you've created it under a different user account and Apache won't get execute access with 644. //end
  3. Building an actionscript Twitter client and using OAuth for the sign in process. By necessity I need to use a php proxy to redirect all calls between my actionscript client and the Twitter server. Having an extrememely frustrating issue with the following error message. '403 Forbidden: The server understood the request, but is refusing to fulfill it.' The following 2 steps ALWAYS work after I click my 'Sign In with Twitter' button, I make it to the Twitter OAuth sign in page so I have the correct request token, etc 1 successfully retrieve request token 2 navigate to Twitter's OAuth login page (following url isn't my actual URL but represents the actual path visible in the browser) *****/twitter/proxy.php?path=http%3A%2F%2Ftwitter.c... But the ONLY way I can proceed further (ie clicking 'Sign In' on the Twitter Oauth sign in page) without getting the 403 error is if the browser has just launched BEFORE navigating to the Twitter OAuth sign in page. Let me explain... ie I have a separate duplicate compiled version of my application on my desktop where I click the 'Sign In with Twitter' button to start the login process. It targets the same php proxy script, retrieves the request token, then issues a navigate to URL command which launches a new browser window, or in this case, launches the browser. Clicking signIn now works correctly, no 403 error Other wise(if the browser has ALREADY been open BEFORE I get to the twitter OAuth Sign In page) I get the 403 forbidden message, even if the username-password fields are blank. What gives? I am totally stumped.... This occurs in BOTH Safari and Firefox in OSX....so I can assume its NOT a browser issue Could this have something to do with the Totalchoice server not being allowed to make requests back to itself? Am going to need some senior tech support it seems to get this resolved...
  4. Hi Can any php experts provide feedback on the following url proxy script? Initially it threw an error, saying the HTTPRequest2 class was missing. So I went to my cpanel, located that particular PHP script and tried installing it. Got an error though trying to install (Thats another issue!) <?php // First validate that the request is to an actual web address if(!preg_match("#https?://#", $_GET['path'])) { header("HTTP/1.1 404 Not found"); echo "Content not found, bad URL!"; exit(); } // Make the request $req = new HTTP_Request2($_GET['path']); $response = $req->send(); // Output the content-type header and use the content-type of the original file header("Content-type: " . $response->getHeader("Content-type")); // And provide the file body echo $response->getBody(); ?>
  5. Hi When trying to install HTTRequest2 I get the following error message Failed to download pear/Net_URL2 within preferred state "stable", latest release is version 0.3.0, stability "beta", use "channel://pear.php.net/Net_URL2-0.3.0" to install pear/HTTP_Request2 requires package "pear/Net_URL2" (version >= 0.2.0) pear/HTTP_Request2 can optionally use PHP extension "fileinfo" No valid packages found install failed /usr/local/jdk/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/lib/courier-imap/sbin:/usr/lib/courier-imap/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/usr/local/bin:/usr/X11R6/bin:/root/bin:/opt/bin
  6. Also, what are the recommended permissions to use for PHP scripts? Is 755 ok? Thanks in advance!
  7. Hi Creating php url proxy and it was recommended that I use HTTP_Request2. Is this possible with the current php configuration at totalChoice? Do I need to first configure anything in my cpanel?
  8. ok getting close...I may start a new post as Im really trying to get this to work this morning My php so far <?php $content = 'http://'; $content .= file_get_contents($_GET['path']); if ($content !== false) { echo($content); } else { // there was an error } ?> The browser error message I get: Warning: file_get_contents(twitter.com/oauth/authorize?oauth_token=) [function.file-get-contents]: failed to open stream: No such file or directory in /home/bitstre/public_html/twitter/proxy.php on line 3 http:// Any feedback welcome!
  9. or even simpler <?php $content = file_get_contents($_GET['url']); if ($content !== false) { echo($content); } else { // there was an error } ?> Do I need to worry about setting the content type header? Thanks in advance!
  10. ok But would you be able to tell me if the following should work? <?php $url = 'http://'; //ensure only twitter domains are used $url .= 'twitter.com/'; if (isset($_GET['path']) && $_GET['path'] != '') { $url .= $_GET['path']; } $mimeType = 'application/xml'; $response = file_get_contents($url); if ($mimeType != "") { header("Content-Type: ".$mimeType); } echo $response; ?>
  11. Hi I'm not a php guru. Am getting an http status error 401 returned when I target a php script. 1 Does this simply mean my permissions are wrong for the file? 2 Are there other things that would cause this? If YES to 1 above, what are the correct permissions for php files. 755 ??
  12. Yes, thought I posted in the wrong forum but didn't know how to delete my original post. In a nutshell I'm building a Twitter client in actionscript and using OAuth for authentication. The initial login (directing the user to twitter's OAuth sign in) works when I compile on the desktop, but NOT so far in a web browser (which requires the php proxy). A php proxy is required because 1- flash has strict security requirements and requires just a crossdomain.xml file to be defined on the remoter server 2-BUT Twitter doesn't allow this crossdomain.xml file The basic steps for OAuth authentication are 1-User first registers their application and obtains a key and secret 2-User requests a REQUEST token(on sign-log in) from Twitter 3-Twitter replies with the request token key 4-This request token is then appended to the Twitter OAuth sign in url at http://twitter.com/oauth/authorize?oauth_token=<insert request key here> 5-On successful sign in, Twitter marks the original request token as user-authorized. The whole process seems a bit convoluted, but OAuth has a number of advantages and is Twitter's recommended scheme for authorization moving forward. Where I seem to be stumbling is step 4, the request token key is not being appended to the OAuth sign in url.
  13. Hi having problems getting a proxy script to work. Getting the following error message "function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.1 403 Forbidden..." Can someone help? this is the script //SCRIPT BEGINS <?php // PHP Proxy $url = 'http://'; if (isset($_GET['sd']) && $_GET['sd'] != '') { $url .= $_GET['sd'].'.'; } //ensure only twitter domains are used $url .= 'twitter.com/'; if (isset($_GET['path']) && $_GET['path'] != '') { $url .= $_GET['path']; } //you can change this to set mimeType via parameters, but //chances are you want xml $mimeType = 'application/xml'; $response = file_get_contents($url); if ($mimeType != "") { header("Content-Type: ".$mimeType); } echo $response; ?> //SCRIPT ENDS
  14. Still trying to remove the redirect....been a while since I've done this..where do I find the .htaccess file? Is it invisible by default?
  • Create New...