Jump to content

angelleye

Members
  • Posts

    44
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

angelleye's Achievements

Member

Member (2/5)

0

Reputation

  1. Seems to be working on the servers I'm playing with now. I don't know why I thought it seemed to take me to the actual document root instead of the site root in the past. I guess I'm good for now. Thanks!
  2. Ok, that makes sense. Can you provide any tip on how to get PHP to always refer to the site root no matter what server it's running from?
  3. I'm a little confused with the use of absolute paths in PHP. I've always used relative paths but it's becoming an issue with some of the apps I'm working with and absolute would solve the problem. The thing is, I'm getting different results in different places and I'm a little confused. With regular HTML I seem to be able to use / as the root of my site. So if I do the following... <img src="/images/name.jpg" /> That works fine no matter what page it's called from in the site and no matter what directory that page is in. I need to be able to do that same thing with PHP. Now, in my custom 404 page I have the following... if($AddressURL == 'http://www.domain.com/blog/files/filename.zip') { header('HTTP/1.1 301 Moved Permanently'); header('Location: /download/filename.zip'); exit(); } That actually works just fine. If I go to the /blog/files/filename.zip (which doesn't exist) in a web browser it winds up downloading the file at www.domain.com/download/filename.zip as expected. Now where I get confused is that include files don't seem to work like that with PHP. If I do this... require_once('/includes/config.php'); That winds up looking for an /includes folder all the way back at the local server root, not just the web root. so it's looking for /var/includes instead of /var/www/includes and of course that doesn't end up working. So, how come the include file paths work differently than regular HTML paths or header redirects in PHP? Is there any simple way I can always refer to the SITE root no matter what server it's running from? I've tried playing with $_SERVER['DOCUMENT_ROOT'] but it only seems to return the root of the current document, not the root of the whole site. So if I use it within a php file located in /var/www/includes/test.php it considers /includes the root which is not what I want. Any information would be greatly appreciated. Thanks!
  4. Updating your database is not recommend on your return page. There is no guarantee the user will return to the return page (even with auto-return enabled). You should use IPN https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_admin_IPNIntro instead, which is always guaranteed to take place. It's server to server communication, though, so it's a little bit tougher to setup. I created a solution that a lot of people are using. It's posted on PayPal's developer forum: https://www.x.com/thread/30664
  5. This should be real simple I just don't know how to do it. I'm using PayPal IPN to process order data. IPN is setup to automatically re-try the IPN if doesn't receive a 200 OK response back from the IPN script. In my solution, though, I'm actually storing any MySQL errors and notifying the site owner so the script actually does successfully complete and send a 200 OK back to PayPal, therefore, the IPN is not re-tried. I'd like to send a 500 (or anything other than 200) back to PayPal when this happens, but of course, the script still needs to run successfully. Is there a way I can use header() or anything to force a specific response code back? This way if it's simply a matter of MySQL timing out (which tends to happen on shared servers sometimes) PayPal's system will re-try and I won't have to enter it myself. Any information on this would be greatly appreciated. Thanks!
  6. You can specify a return_url in your html button code (as well as API requests) that will override anything you have set in your account profile. This way you can send dynamic return URL's with each payment instead of setting up a static URL in your profile. When using PayPal Standard, though, there is no guarantee the user will end up back at your site even with auto-return turned on. They could close the browser before the return happens. If you need to rely on this for updating a database, sending out email receipts, etc. you should use IPN and notify_url instead.
  7. Yes, the host header is needed because I'm hosting more than 1 site on the same IP address and the same port. That part is all working fine. I've figured out that when I comment out the doc_root in php.ini then PHP pages will indeed load on the sites, however, all of my relative links to includes like css, js, etc. aren't working when I do that. Apparently what I need is to specify separate php.ini files for each site, or specify multiple doc_root's in a single php.ini file. Possible..??
  8. I've got a test server setup at sandbox.mydomain.com on Win2k3 with IIS 6. I've got PHP installed on this server and it works great on the default web site in IIS. I've always had my client web sites under /client-sites on my default web site. The problem with this is that when my clients are using things like ./ in their links it goes back up to my actual root instead of their site's root (ie. sandbox.mydomain.com/client-sites/site-name). To fix this I've gone ahead and created additional A records in my DNS to point other sub-domains to my test server (ie. client.mydomain.com) and then I created a new site in IIS and applied the host header value of client.mydomain.com. With that I can successfully browse the client's site via http://client.mydomain.com, however, PHP does not work on these additional sites. It still works great on my default site in IIS, just not on any of the extra sites I add this way. I can browse HTML files, txt files, images, etc. just fine but anything PHP just gives me page not found. Any information on how I can make PHP work with ALL sites in IIS instead of just the default would be greatly appreciated. Thanks!
  9. I've installed PHP on Win2k3 a number of times and I've never had a problem. This particular server is driving me nuts. I cannot figure out why PHP won't work on this IIS install. Here's what I've done. 1) Download the ZIP package of PHP for manual installation 2) Extract the files to C:\PHP 3) Edit php.ini in the following ways... - include_path = ".;c:\php\includes" - doc_root = "W:\" - extension_dir = "C:\PHP\ext" -cgi.force_redirect = 0 4) Added PHP to the Web Service Extensions in IIS and set it to the php5isapi.dll file. 5) Added C:\PHP to the Path variable under the system's Enviornment Variables and I also added a new variable called PHPRC with C:\PHP\php.ini 6) Reboot the server This usually takes care of everything and I can move on to MySQL install and then start putting my apps up. Not in this case. I'm getting 404 error any time I try and browse a PHP file on this web server. If I simply change that file to .txt instead of .php then it loads fine. Switch it back to .php and I get a 404 again. I've followed all of the steps here to try and troubleshoot (http://www.verysimple.com/blog/2008/01/05/php-on-windows-2003-iis-6-displays-404-page-not-found/) and nothing is working. I also tried running the file (which has nothing but echo 'test'; in it right now) from a command line and that is working just fine, so PHP itself is indeed functioning on the server. It's just that it's not communicating with IIS for some reason. I double checked that I added my Web Service Extension and it's in there as PHP with php5isapi.dll and it's set to Allowed. I've also compared this to my own working test server here and the only difference I can see is that they have MS SharePoint and FrontPage extensions installed and I've never had that in the mix. It's created an additional web site and an additional application pool apart from the defaults. I have no idea if that's causing any of my problems but it's the only thing different I see from all of the servers I've done this on in the past. Any information on how I can fix this would be greatly appreciated. Thanks!
  10. On my phpinfo it shows log_errors is On but then when I go to error_log to try and see the path for the actual file so I can look at it I see 'no value'. I don't see anything in the php.ini about setting an actual file. What am I missing? I've got some errors happening on a script that gets hit behind-the-scenes (PayPal Notification system) and I see in my web logs that I'm getting a 500 error but I can't see the actual error code or messages getting returned. Any information would be greatly appreciated. Thanks!
  11. Looks like that's working. I could have sworn I tried that but I guess not. Thanks!!!
  12. I've got some scripts setup that have if statements inside them but I like to avoid using else unless I really need it. For example, something like... if(count($Errors) > 0) { $_SESSION['Errors'] = $Errors; header("Location: error.php"); } // if no error go ahead and move on. No need for else because if there is error it redirects away from here anyway. That idea seems to work fine for me as long as I don't end the whole page with a redirect. An example of when this happens is when I've got a script that's adding all of the order info to a DB and at the end redirects to a successful/receipt page. The very last thing on this script would be a redirection. The problem is that if I have something like the following... if(count($Errors) > 0) { $_SESSION['Errors'] = $Errors; header("Location: error.php"); } // no errors so call was successful, redirect to paypal header("Location: payment-complete.php"); and there are indeed errors in $Errors it doesn't redirect to the error.php page. I end up at my payment-complete.php page with errors because of course it doesn't get all of the data it expects since the error occurred and it should ahve never reached that page to begin with. What's interesting is that if I remove the redirect at the very bottom where I assume everything works and just do something like echo a line.. if(count($Errors) > 0) { $_SESSION['Errors'] = $Errors; header("Location: error.php"); } // no errors so call was successful, redirect to paypal echo 'it worked'; Then it does indeed redirect to my error.php as it should when errors occur. So it seems like the entire PHP script is getting parsed and if there are no PHP failures then the final header() just loads regardless. But if I don't have a header() outside of my if statements then they will indeed work inside those if statements. I hope I explained that well enough. I'm confused about why it's happening. Any information on this would be greatly appreciated. Thanks!
  13. This is running on my test server and I've already got that set to show all. I'm not getting any errors or warnings.
  14. Hmmm...looks like a great source but I'm not having any luck. Following the instructions and using that FireFox tool I see that when I login it actually seems to go through a few pages. Here's what it gave me.. https://developer.paypal.com/cgi-bin/devscr?__track=_logout:login/main:_login-submit POST /cgi-bin/devscr?__track=_logout:login/main:_login-submit HTTP/1.1 Host: developer.paypal.com User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.13) Gecko/20080311 Firefox/2.0.0.13 Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5 Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 300 Connection: keep-alive Referer: https://developer.paypal.com/cgi-bin/devscr?cmd=_logout Cookie: homepage=3; upct=24; KHcl0EuY7AKSMgfvHl7J5E7hPtK=bFrgcM30Gb-2b3E85K4SiHyEzsMZeRVIqxjlur44o74QGXZnvTnHGme_QggT-eQFT34cVqPLl1OhGdE_; cookie_srd_optin=true; s_pers=%20s_favsn_paypalglobal_1%3D9856380030122%7C1505841661312%3B; cookie_check=yes; login_email=andrew%40angelleye.com; INSIDE_SEARCH_PARAMS=2%3bUS%3ben_US%3bAmerica%2fLos_Angeles; navlns=0; LANG=en_US%3bUS; nMjq0zk0-yCYE_iBONIGREETTNW=; dev_login_email=andrew%40angelleye.com; wwp_ClJZM3hWN6BNtpFD0LimhmC=; __login_track=SJZDNH8fctvqVf3Kf226tZyuuqtefbzza2dCsGL5wgEnnp25shrKG7LFry0 Content-Type: application/x-www-form-urlencoded Content-Length: 116 cmd=_login-submit&login_cmd=&login_params=&login_email=LOGIN_EMAIL&login_password=LOGIN_PW&submit=Log+In HTTP/1.x 302 Found Date: Wed, 09 Apr 2008 05:21:28 GMT Server: Apache/1.3.27 (Unix) mod_ssl/2.8.12 OpenSSL/0.9.7a mod_fastcgi/2.4.2 PHP/4.3.2 Cache-Control: private Expires: Thu, 05 Jan 1995 22:00:00 GMT Pragma: no-cache Set-Cookie: nMjq0zk0-yCYE_iBONIGREETTNW=Jpm8RBa7sT64hIbo8v2itdfrzX6QWIO7bstdDvYj-dzgOOwis787txlMhLTiBzIPKo7tuLE2flqqRVTd3ISWJF63NnC; expires=Sat, 06-Sep-2008 05:21:31 GMT; path=/; domain=.paypal.com Set-Cookie: dev_login_email=andrew%40angelleye.com; expires=Mon, 06-Oct-2008 05:21:31 GMT; path=/; domain=.paypal.com Set-Cookie: wwp_ClJZM3hWN6BNtpFD0LimhmC=; path=/; domain=.paypal.com Set-Cookie: __login_track=SJZDNH8fctvqVf3Kf226tZyuuqtefbzza2dCsGL5wgEnnp25shrKG7LFry0; path=/; domain=.paypal.com Location: https://developer.paypal.com/cgi-bin/devscr?cmd=_login-processing&login_cmd=_login-done&login_access=0 Connection: close Transfer-Encoding: chunked Content-Type: text/html; charset=iso-8859-1 ---------------------------------------------------------- https://developer.paypal.com/cgi-bin/devscr?cmd=_login-processing&login_cmd=_login-done&login_access=0 GET /cgi-bin/devscr?cmd=_login-processing&login_cmd=_login-done&login_access=0 HTTP/1.1 Host: developer.paypal.com User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.13) Gecko/20080311 Firefox/2.0.0.13 Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5 Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 300 Connection: keep-alive Referer: https://developer.paypal.com/cgi-bin/devscr?cmd=_logout Cookie: homepage=3; upct=24; KHcl0EuY7AKSMgfvHl7J5E7hPtK=bFrgcM30Gb-2b3E85K4SiHyEzsMZeRVIqxjlur44o74QGXZnvTnHGme_QggT-eQFT34cVqPLl1OhGdE_; cookie_srd_optin=true; s_pers=%20s_favsn_paypalglobal_1%3D9856380030122%7C1505841661312%3B; cookie_check=yes; login_email=LOGIN_EMAIL; INSIDE_SEARCH_PARAMS=2%3bUS%3ben_US%3bAmerica%2fLos_Angeles; navlns=0; LANG=en_US%3bUS; nMjq0zk0-yCYE_iBONIGREETTNW=Jpm8RBa7sT64hIbo8v2itdfrzX6QWIO7bstdDvYj-dzgOOwis787txlMhLTiBzIPKo7tuLE2flqqRVTd3ISWJF63NnC; dev_login_email=LOGIN_EMAIL; wwp_ClJZM3hWN6BNtpFD0LimhmC=; __login_track=SJZDNH8fctvqVf3Kf226tZyuuqtefbzza2dCsGL5wgEnnp25shrKG7LFry0 HTTP/1.x 200 OK Date: Wed, 09 Apr 2008 05:21:31 GMT Server: Apache/1.3.27 (Unix) mod_ssl/2.8.12 OpenSSL/0.9.7a mod_fastcgi/2.4.2 PHP/4.3.2 Cache-Control: private Expires: Thu, 05 Jan 1995 22:00:00 GMT Pragma: no-cache Connection: close Transfer-Encoding: chunked Content-Type: text/html; charset=UTF-8 ---------------------------------------------------------- https://developer.paypal.com/cgi-bin/devscr?cmd=_login-done&login_access=0 GET /cgi-bin/devscr?cmd=_login-done&login_access=0 HTTP/1.1 Host: developer.paypal.com User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.13) Gecko/20080311 Firefox/2.0.0.13 Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5 Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 300 Connection: keep-alive Referer: https://developer.paypal.com/cgi-bin/devscr?cmd=_login-processing&login_cmd=_login-done&login_access=0 Cookie: homepage=3; upct=24; KHcl0EuY7AKSMgfvHl7J5E7hPtK=bFrgcM30Gb-2b3E85K4SiHyEzsMZeRVIqxjlur44o74QGXZnvTnHGme_QggT-eQFT34cVqPLl1OhGdE_; cookie_srd_optin=true; s_pers=%20s_favsn_paypalglobal_1%3D9856380030122%7C1505841661312%3B; cookie_check=yes; login_email=LOGIN_EMAIL; INSIDE_SEARCH_PARAMS=2%3bUS%3ben_US%3bAmerica%2fLos_Angeles; navlns=0; LANG=en_US%3bUS; nMjq0zk0-yCYE_iBONIGREETTNW=Jpm8RBa7sT64hIbo8v2itdfrzX6QWIO7bstdDvYj-dzgOOwis787txlMhLTiBzIPKo7tuLE2flqqRVTd3ISWJF63NnC; dev_login_email=LOGIN_EMAIL; wwp_ClJZM3hWN6BNtpFD0LimhmC=; __login_track=SJZDNH8fctvqVf3Kf226tZyuuqtefbzza2dCsGL5wgEnnp25shrKG7LFry0 HTTP/1.x 200 OK Date: Wed, 09 Apr 2008 05:21:33 GMT Server: Apache/1.3.27 (Unix) mod_ssl/2.8.12 OpenSSL/0.9.7a mod_fastcgi/2.4.2 PHP/4.3.2 Cache-Control: must-revalidate, proxy-revalidate, no-cache Set-Cookie: nMjq0zk0-yCYE_iBONIGREETTNW=8qM5LB9CpXGBE5a_I5Rhcbxm4Gh5sb9jkHZIp48LnFbNJ_aBcwM3cLz6hMWmXxvggy0dck9TI_dy2xGNAa9b_KE9Nme; expires=Sat, 06-Sep-2008 05:21:34 GMT; path=/; domain=.paypal.com Connection: close Transfer-Encoding: chunked Content-Type: text/html; charset=UTF-8 ---------------------------------------------------------- So based off that and trying to go off this sample I've got the following: <?php include_once("../includes/Functions.php"); $PayPalDevUsername = "LOGIN_EMAIL"; $PayPalDevPassword = "LOGIN_PASSWORD"; $PayPalDevLoginURL = "https://developer.paypal.com/cgi-bin/devscr?__track=_home:login/main:_login-submit"; $PayPalDevLoginCredentials = "cmd=_login-submit&login_cmd=&login_params=&login_email=" . $PayPalDevUsername . "&login_password=" . $PayPalDevPassword . "&submit=Log+In"; $ch = curl_init(); curl_setopt($ch, CURLOPT_COOKIEJAR, "cookies.txt"); curl_setopt($ch, CURLOPT_COOKIEFILE, "cookies.txt"); curl_setopt($ch, CURLOPT_URL, $PayPalDevLoginURL); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_REFERER, "https://developer.paypal.com/devscr?cmd=_logout"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $PayPalDevLoginCredentials); $res = curl_exec($ch); curl_close($ch); $PayPalDevLoginURL = "https://developer.paypal.com/cgi-bin/devscr?cmd=_login-processing&login_cmd=_login-done&login_access=0"; $ch = curl_init(); curl_setopt($ch, CURLOPT_COOKIEJAR, "cookies.txt"); curl_setopt($ch, CURLOPT_COOKIEFILE, "cookies.txt"); curl_setopt($ch, CURLOPT_URL, $PayPalDevLoginURL); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_REFERER, "https://developer.paypal.com/devscr?cmd=_logout"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, ""); $res = curl_exec($ch); curl_close($ch); $PayPalDevLoginURL = "https://developer.paypal.com/cgi-bin/devscr?cmd=_login-done&login_access=0"; $ch = curl_init(); curl_setopt($ch, CURLOPT_COOKIEJAR, "cookies.txt"); curl_setopt($ch, CURLOPT_COOKIEFILE, "cookies.txt"); curl_setopt($ch, CURLOPT_URL, $PayPalDevLoginURL); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_REFERER, "Referer: https://developer.paypal.com/cgi-bin/devscr?cmd=_login-processing&login_cmd=_login-done&login_access=0"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, ""); $res = curl_exec($ch); curl_close($ch); ?> When I run that I get a blank white page and I still can't access the PayPal sandbox. Any ideas??
  15. Well, actually, I use curl in my current scripts to make XML/SOAP calls to the PayPal Web Services. I just include credentials in the SOAP requests, though, so I haven't had to dig too deep into actual curl headers. Can you possibly refer me to a good example of this being done? I'm having some trouble finding anything for some reason.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.