Code runs fine on localhost but not on Facebook. Maybe because of CURL? - facebook

The following code gives fine output while running on localhost. Earlier it was giving some error related to CURL so i fixed it and now its running fine on localhost.
But my app is not running on facebook.I am using HEROKU so is it having same problem of CURL?? If so than how can i fix it?? I hav even uploaded PHP SDK on heroku. My IE gives error 500 and firefox gives a blank screen.
<html>
<head>
<title>Test</title>
</head>
<body>
<?php
include 'libs/facebook.php';
$facebook=new Facebook(array(
'appId'=>'************',
'secret'=>'********************',
'cookie'=>true
));
$me=null;
if($me)
{
$logoutUrl=$facebook->getLogoutUrl();
echo "<a href'$logoutUrl'>Logout</a>";
}
else
{
$loginUrl=$facebook->getLoginUrl();
echo "<a href='$loginUrl'>Login</a>";
}
?>
</body>
</html>

The code you posted will always ask for the login url because $me will always be null.
As to the rest of the errors, try adding error reporting to the top of your file
error_reporting(E_ALL);
ini_set("display_errors", 1);
Then deploy, then run heroku logs --tail locally to see what is going on in the file.
Also place your PHP section above your HTML outside the <html> tag.

Related

TestCafe Login with .httpAuth suddenly does not work anymore. Page shows html "...charset-hammerhead-shadow-ui..."

A super simple Fixture (TestCafe Script) with .httpAuth worked fine at first. Then I had a few password resets with my Windows account. And now when running the same Fixture the browser shows about 12 lines of html code:
<html><head><meta class="charset-hammerhead-shadow-ui" charset="iso-8859-1"><link rel="stylesheet" type="text/css" class="ui-stylesheet-hammerhead-shadow-ui" href="http://172.24.88.142:2346/testcafe-ui-styles.css"><script type="text/javascript" class="script-hammerhead...........etc
This is with Edge browser and also with Chrome. With IE it opens an empty page :-(
I even deleted the browser cache for Edge and IE but with no luck.
testcafe -v : 1.19.0
Edge Version 103.0.1264.44 (Official build) (64-bit)
new-fixture.testcafe.js:
fixture `New Fixture`
.page `http://my.company/path`
.httpAuth({ username: 'myusername', password: 'mypassword', domain: 'mydomain' });
test('New Test', async t => {
await t
.click('body');
});
PS:
I am new to TestCafe and TestCafe Studio and I defenitely like it!
With one of my first tests with TestCafe Studio I opened our intranet with a Codeless recording resulting in "401 UNAUTHORIZED".
So I clicked the Fixture > Edit and chose 'Basic HTTP/NTLM authentication' and entered my User name, Password and Domain.
The code worked fine for about a day!!! :-)
BUT THEN for the next two days I had several times my Windows Account LOCKED OUT. At first our IT people helped me to reset my password and then I found that I can click on "Reset password" on the login screen myself!
Anyhow, my TestCafe script does not work anymore since then, showing just the 12 lines of html code.
Please Help!

Loading PayPal Smart Buttons (JS SDK) with Brave Browser throws errors

I'm trying to get a basic PayPal button on my web page, but I can't even load the API without getting errors. I've asked for help on PayPal's own forum, but no one replies.
Here is my page. I'm running in sandbox mode. I've replaced the actual client ID below with [CLIENTID].
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>PayPal test</title>
</head>
<body>
<script src="https://www.paypal.com/sdk/js?debug=true&client-id=[CLIENTID]"></script>
</body>
</html>
I can add a button to the page, and make a purchase, so the buying process works. But it always throws this error at page load. I'm on Win10, Brave Browser (based on Chromium).
js?debug=true&client…ruzpDLhao-FzS6:2659 unhandled_error
{err: "Error: Invalid json: .↵ at XMLHttpRequest.<anon…[CLIENTID]:2597:55)", timestamp: "1601234382102", referer: "localhost", uid: "9b7c68f416_mtk6mtc6ntq", env: "sandbox"}
env: "sandbox"
err: "Error: Invalid json: .↵ at XMLHttpRequest.<anonymous> (https://www.paypal.com/sdk/js?debug=true&client-id=[CLIENTID]:2597:55)"
referer: "localhost"
timestamp: "1601234382102"
uid: "9b7c68f416_mtk6mtc6ntq"
__proto__: Object
===============================================================
UPDATE
Sorry, I incorrectly wrote I am on Google Chrome. I'm on Brave Browser (based on Chromium). I've tested on Google Chrome and MS Edge, and it works there. Brave is where the errors happen. I've tried to add a new sandbox app, but get the same error. I've used the Brave browser settings to allow my site all privileges, but still the same error.
Live test:
Just loading API: https://www.trainerslab.app/PayPalTest.html
Example from PayPal dev site: https://www.trainerslab.app/PayPalTest2.html
Screenshot:

Cannot save template constants in typo3

I updated the constants of my template in the web editor of typo3. Each time I click on Save or Close+Save I get a pop-up from my browser to download a file. The content is like this:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>503 Service Unavailable</title>
</head><body>
<h1>Service Unavailable</h1>
<p>The server is temporarily unable to service your
request due to maintenance downtime or capacity
problems. Please try again later.</p>
</body></html>
The minimal example to get this is:
page.theme {
socialmedia.channels {
facebook.url = https://www.facebook.com/typo3/
}
}
It seams that Typo3 has a problem with the dots in the url. If I remove all of them or escape with a backslash "\" everything works. (But the backslash remains in the url and therefore produce invalid urls)
Some months before everything works fine. Some other templates in the same installation have also urls in their configuration and they are working (the page is rendered normaly). If I try to save them noe without any changes I get the same error.
That is the system I use:
Typo3-Version: 9.5.20
Webserver: Apache/2.4.43 (Unix)
PHP-Version: 7.3.21
Database: MySQL 5.6.42
Applicationcontext: Production
OS: SunOS SunOS localhost 5.10 Generic_150401-49 i86pc
Bootstrap Package: 11.0.2

Beginner Bottle and static files question

After using the Python http.server module I'm now trying to convert everything to Bottle and can't even get started. My problem is locating static files - everything I've tried results in a "404" error. So I've tried to reduce everything to the simplest possible example. My top level directory is in "/home/dave/test" and under that is a single file (test.py), and a subdirectory ("/home/dave/test/static") containing the single file "index.html". The html file is pretty basic:
<!DOCTYPE html>
<html lang="en">
<head>
<title>Bottle Test</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<h1>Hello, World</h1>
</body>
</html>
If I double click on the file itself, it opens a new browser page and displays the "Hello, World" message. The test.py file is:
#!/usr/bin/env python3
from bottle import route, run, static_file
#route('/static/<filename>')
def server_static(filename):
return static_file(filename, root='/home/dave/test/static')
run(host='localhost', port=8080, debug=True)
If I open a browser window and enter "localhost:8080/index.html" I get back the "Error: 404 Not Found" message and the terminal window where I'm running the script looks like:
$ ./test.py
Bottle v0.12.16 server starting up (using WSGIRefServer())...
Listening on http://localhost:8080/
Hit Ctrl-C to quit.
127.0.0.1 - - [06/Apr/2019 15:31:25] "GET /index.html HTTP/1.1" 404 740
I've tried various permutations of the URL and root parameter but nothing I've tried works. Clearly I'm missing something very basic here. Can somebody tell me what is wrong in in the above files (or URL)?
Thanks,
Dave
I was able to contact the author of Bottle and he responded:
a route matches against the path-part of an HTTP request URL. In your
example, '/static/' would match requests to
http://localhost:8080/static/index.html and serve 'index.html' file
from the '/home/dave/test/static' directory.
"http://localhost:8080/index.html" does not match the route you
specified, thus the 404 error.
I tried this and it did indeed fix the problem.

Publishing to Azure Mobile Service with Lets Encrypt certificate gives Runtime Error

I have set up a new Azure Mobile App Service instance which has been working fine. The only thing I can think that I've done to the server side configuration is add a Lets Encrpyt certificate to provide SSL support using the Lets Encrypt Azure Extension.
Now, when I publish, I get a Runtime Error. Looking in the Azure streaming logs, I can see the following every time I hit the application URL:
2017-06-29T13:54:07 Welcome, you are now connected to log-streaming service.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>IIS Detailed Error - 500.0 - Internal Server Error</title>
</head>
<body>
<div id="content">
<div class="content-container">
<h3>HTTP Error 500.0 - Internal Server Error</h3>
<h4>The page cannot be displayed because an internal server error has occurred.</h4>
</div>
<div class="content-container">
<fieldset><h4>Most likely causes:</h4>
<ul> <li>IIS received the request; however, an internal error occurred during the processing of the request. The root cause of this error depends on which module handles the request and what was happening in the worker process when this error occurred.</li> <li>IIS was not able to access the web.config file for the Web site or application. This can occur if the NTFS permissions are set incorrectly.</li> <li>IIS was not able to process configuration for the Web site or application.</li> <li>The authenticated user does not have permission to use this DLL.</li> <li>The request is mapped to a managed handler but the .NET Extensibility Feature is not installed.</li> </ul>
</fieldset>
</div>
<div class="content-container">
<fieldset><h4>Things you can try:</h4>
<ul> <li>Ensure that the NTFS permissions for the web.config file are correct and allow access to the Web server's machine account.</li> <li>Check the event logs to see if any additional information was logged.</li> <li>Verify the permissions for the DLL.</li> <li>Install the .NET Extensibility feature if the request is mapped to a managed handler.</li> <li>Create a tracing rule to track failed requests for this HTTP status code. For more information about creating a tracing rule for failed requests, click here. </li> </ul>
</fieldset>
</div>
<div class="content-container">
<fieldset><h4>Detailed Error Information:</h4>
<div id="details-left">
<table border="0" cellpadding="0" cellspacing="0">
<tr class="alt"><th>Module</th><td> AspNetInitializationExceptionModule</td></tr>
<tr><th>Notification</th><td> BeginRequest</td></tr>
<tr class="alt"><th>Handler</th><td> ExtensionlessUrlHandler-Integrated-4.0</td></tr>
<tr><th>Error Code</th><td> 0x00000000</td></tr>
Has anyone come across this problem before?
OK< bit of an obscure and edge case one this, but thought I'd leave it here with the answer in case it helps someone.
I created the site and published it with it all working fine. I then changed the assembly name to fit in with my project naming standards and re-published, without selecting 'DELETE ALL FILES' becuase it would wipe out the Lets Encrypt extension settings. However, this lef the old DLL's hanging around in the \bin directory meaning there were two OWIN startup classes being found!
Deleting the old one fixed the issue.