Trouble in hosting Facebook Apps - facebook-php-sdk

I'm new to the Facebook application world and web hosting stuff.
I tested my Facebook apps locally and it runs well. However, when I try to put on my server, nothing happens, just a blank page.
When I try to do some program without the Facebook PHP-SDK it runs well. But when I use it nothing happens.
I think this is a newbie question but I don't know where else I should put it.
I'm using xampp, in the log appears:
::1 - - [22/Oct/2011:19:30:15 +0100] "POST /temp/ HTTP/1.1" 200 4253 "https://apps.facebook.com/first_app_diogo/" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:7.0.1) Gecko/20100101 Firefox/7.0.1"
this is locally, I see POST above, so it looks like is making a POST request, right?
My app is a canvas app.
I created a free hosting account in bytehost to put my app online, but doesn't work, I already tried with another web hosting, and had the same result. Even the simplest app that calls a the facebook API doesn't work...
I activated runtime error reporting in php and got the following error:
Fatal error: Uncaught exception 'Exception' with message 'Facebook needs the CURL PHP extension.' in /home/vol3/byethost7.com/b7_9378562/htdocs/php-sdk/src/base_facebook.php:19 Stack trace: #0 /home/vol3/byethost7.com/b7_9378562/htdocs/php-sdk/src/facebook.php(18): require_once() #1 /home/vol3/byethost7.com/b7_9378562/htdocs/config.php(3): require('/home/vol3/byet...') #2 /home/vol3/byethost7.com/b7_9378562/htdocs/index.php(6): require('/home/vol3/byet...') #3 {main} thrown in /home/vol3/byethost7.com/b7_9378562/htdocs/php-sdk/src/base_facebook.php on line 19
so, it looks like the curl extension is disabled in my server. It worked locally because I enabled the curl extension in xampp. But how do I enabled it in my free server?
I know this isn't a programming question, but I'm really stuck on this.

What's in your server logs?
Is your app a canvas or page tab app?
If so, bear in mind that Facebook will send a POST request, not a GET request, when passing the signed_request to your application - if you were testing locally without any Facebook integration you were probably making GET requests

I finnally solved it, my free hosting provider didn't support curl, so I got another account in a different provider that supports curl. However, after that, I got the SSL problem, because since 01/10/2011 every facebook app require a SSL certificate, so I went to http://social-server.com/index/info.php in order to deliver content via SSL.
Hope this helps anyone with the same problem.

Related

Diagnosing an additional redirect in a "Request initiator chain" when moving from localhost to a hosted site

I'm in the process of deploying my React site to AWS via Amplify, and the first step on the site is authenticating with Spotify. Here in their auth guide, they call the type of auth I am performing "Authorization Code Flow" where the first step is the site requesting a scoped auth and receiving a code via a http redirect.
This all works fine and dandy when I am running the app locally - the network logs and associated looks like this (apologies, I'm not sure how to best reproduce for you this devtools output):
localhost network logs
localhost initiator chain
But when I attempt this on my live site soundfound.io I instead receive in additional redirect which makes it impossible for me to retrieve the code (I believe at least - I could not figure out a workaround where I just capture the code from the 2nd 302 here but if you do, please enlighten me b/c I'm at the end of my rope here).
live network logs
localhost initiator chain
and here - my boilerplate AWS Amplify domain config: https://ibb.co/SV1N809
I've been reading up but this is just not clicking with me - WHO or WHAT is causing this additional redirect? It's certainly not the React application itself, that doesn't make any sense. Spotify knows about both redirect urls (localhost:3000/redirect and soundfound.io/redirect) so I don't understand how that could behave differently. The only place I can think to look is within the domain registration and control part of AWS Amplify - but I don't see (or don't understand) anything that would cause this sort of issue?
I'm just so lost as to where to begin trying to troubleshoot this, any and all help would be appreciated. Thanks
The AWS Amplify automatically creates a rule in the console App settings under "Rewrites and redirects" that redirects all requests to my base domain "soundfound.io" to "www.soundfound.io". Erasing this rule solved the issue.

Azure VM IIS HTTP Status Codes Changed

I have a couple Azure VMs behind a Basic Load Balancer with an HTTP URL Health Probe for the Backend Pool. To mark a server down, that URL returns Status Code 503 (Service Unavailable), but when I call that page from those VMs, the Status Code returned is 403. That still has the desired effect, I suppose, of marking the server down - but I dont understand why the code I set has changed.
This is from an ASP.NET web forms application on the VMs. I look at developer tools in the browser, and from my local machine or from a Dev server on our local network, that page returns Status Code 503, but calling that page from the VMs in Azure, the Status Code is 403.
Here's where I set the Status Code in that page:
Response.Clear()
Response.StatusCode = 503
Response.Flush()
I suppose I should mention that my local is a Windows 10 box, and the server VM is Windows Server 2016. Both are running IIS 10. The application is compiled with .NET Framework 4.6.
Here's the dev tools from my localhost:
Here's the dev tools from the server in azure:
Why the change? Anything I can do to stop this behavior?
So today I tried enabling Failed Request Tracing, but either something wasnt set up correctly, or the error was being handled elsewhere, and didnt result in any failed requests being logged.
Since I wasnt getting any failed requests logged, I opened up Process Monitor and could see that immediately after the call to my Health Probe page, I was getting a call to my custom HTTP Error page. That page must have been what was giving the 403 (dont know why, b/c that page works correctly for other HTTP Errors with a friendly error message and logging of the error to my custom error tracking solution).
I was going to change the Status Code to see if there was something special with the 503 that I was setting that was handled differently in IIS, but that got me thinking about how I was setting the status code...
In my research today, I saw this page https://www.leansentry.com/HowTo/AspNet-Response-Flush-Poor-Performance which cautions against using Response.Flush(). The code that I had implemented was in the Page_PreRender method, so there's not really a need to Flush there anyway.
I removed the Response.Flush and of course, my troubles went away.
The Health Probe page no longer triggers an Error from the Azure VM, and therefore, the status code that I get in my client browser is the 503 that I set in code.
So I guess this case is closed. I will need to figure out why the HTTP Error page was throwing a 403 instead of returning the friendly error message, but that should be easy enough...

ASP.NET debugger gives errors with http, while working with https

I really desperately need your help because I got very unusual problem with my programs:
I am receiving this error when I am trying to debug my ASP.NET or MVC Application on local IIS Server 7.5:
"Unable to start debugging on the web server. The debug request could not be processed by the server due to invalid syntax. "
I tried literally every solution I could find in google until this day. I spent 12 hours trying to figure this out. Without luck.
Error happens only with this address: http:// localhost/AspDemo not with this one: https:// localhost/AspDemo. Basically, I can debug like always if I put https instead of http.
https is disabled on my local IIS server :), I mean it is set to ignore.
Moreover I CAN open my sites with using BOTH protocols in IIS Control Panel
If I disable ASP.NET Debugger in Properties of my App in Visual Studio, Application runs fine.
This is the error from the httperr log:
2014-10-30 00:23:46 ::1%0 2977 ::1%0 80 - - - 400 - Verb -
I am not sure where exactly, but in some other log I saw reference to something like this: Error 400 "Bad Request - Invalid Verb"
A week ago ALL applications I got problems with were working perfectly with asp.net debugger from visual studio, I had no idea what happened.
I suspect some update. Because updates lately messed with my custom bootloader as well.
When I enable tracing - log is empty with http
Fiddler log is empty as well, maybe there is some config I can use in Fiddler to produce some more logs? (It logs of course with modified machine.config when I use https)
Would be eternally grateful for your help, if you need some more logs, please don't hestitate to ask.
I would like to mention as well that yes, I saw similar posts on this site, but none of them described problem this similar to mine.
/edit
From what I was able to observe, error happens BEFORE debugger access machine.config file, can you guys tell me how to catch errors in that moment?
==== /edit 2 ====
Anyone? No one knows the answer?
Recently I was able to find the complete error message in: C:\Users\\AppData\Local\Temp\Visual Studio Web Debugger.log
http://localhost/MVCDemo/debugattach.aspx
Status code=400 (Bad Request)
Protocol version=1.1
Cached=False
Connection=close
Content-Length=326
Content-Type=text/html; charset=us-ascii
Date=Fri, 31 Oct 2014 03:44:14 GMT
Server=Microsoft-HTTPAPI/2.0
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
<HTML><HEAD><TITLE>Bad Request</TITLE>
<META HTTP-EQUIV="Content-Type" Content="text/html; charset=us-ascii"></HEAD>
<BODY><h2>Bad Request - Invalid Verb</h2>
<hr><p>HTTP Error 400. The request verb is invalid.</p>
</BODY></HTML>
In proccess monitor, I found this one as well:
<event>
<ProcessIndex>1339</ProcessIndex>
<Time_of_Day>04:40:33,3661553</Time_of_Day>
<Process_Name>devenv.exe</Process_Name>
<PID>10768</PID>
<Operation>CreateFile</Operation>
<Path>C:\Users\<UserName>\AppData\Roaming\Microsoft\VisualStudio\12.0\Debugger\StepIntoFilterData.ini</Path>
<Result>PATH NOT FOUND</Result>
<Detail>Desired Access: Read Data/List Directory, Read Attributes, Synchronize, Disposition: Open, Options: Sequential Access, Synchronous IO Non-Alert, Non-Directory File, Attributes: n/a, ShareMode: Read, Delete, AllocationSize: n/a</Detail>
</event>
I really, really need help with this.
=== /edit 3 ===
Second error is not relevant, I just checked and it is present with https as well (C:\Users\\AppData\Roaming\Microsoft\VisualStudio\12.0\Debugger\StepIntoFilterData.in), and debugging as https localhost works perfectly.
=== /edit 4 ===
Here are Process Monitor logs captured during Visual Studio Debugging HTTP (not working) and HTTPS (working)
(Test performed on random MVC Tutorial)
Use CTRL+F and Look for "Visual Studio Web Debugger.log" in logs to get the idea when it is happening. In https log is good, in http log returns Invalid Verb error mentioned before.
HTTP (not working)::
https://www.dropbox.com/s/7b26ybogtyqlico/LogFile%20HTTP%20NOT%20Working.CSV?dl=0
HTTPS (working):
https://www.dropbox.com/s/ggsj57v97ky90e6/LogFile%20HTTPS%20Working.CSV?dl=0
I might be wrong, but I think the key here is that only HTTP doesn't work and only with VS Debugger, everything else is just fine (HTTP and HTTPS without debugging and HTTPS with debugging.)
(It happens with every solution on IIS, new ones are affected too, all of these solutions were working, moreover some of them were not even changed from the time they have been working, IIS config didn't change as well)
I do not see the name of the verb in any of the description here, but my guess is VS debugger using a special verb (DEBUG) rather than the standard GET, HEAD, POST, etc. If you re-installed IIS after VS, the ISAPI mapping probably got nuked. This may solve the problem:
https://msdn.microsoft.com/en-us/library/ms165022%28v=vs.90%29.aspx

localhost tesing oAuth - Yahoo, MSN, Hotmail, Facebook

I know that there are many questions like this, but most seem to be older.
I know all about setting up my web app on the above services, and have seen that most require a valid domain for a callback [www.abc.com/oauthReturn.aspx].
What do I need to do in order to test locally, where the return URL would be: http://localhost:0000/oauthReturn.aspx ?
You can't use http://127.0.0.1 in Yahoo - not a valid URL.
I'm running asp.net/VB.net, IIS7. Localhost runs Windows 7 & Prod server runs Windows 2008 server.
When I try accessing the microsoft site, I get an error message, after I sign in, about not allowing localhost.
Any help is appreciated.
Thanx
Jerry
Try following the instructions here. Make sure to read all the way to the bottom where they suggest registering the localhost call back URL in bit.ly (or some other URL shortener) and using the bit.ly link as the call back URL.

Cannot get ASP.Net to serve any pages under IIS6

I am trying to set up another instance of a live website for a customer to evalulate, however i am unable to get the server to serve up any ASP.NET pages at all.
I know this is normally a bit of a noob question, but i have set up these servers a hundred times and know all the usual gotchas, i have done all of the following to no avail, and for my example i have created a simple test page that writes out hello world, and i'm still unable to get anything to serve..
This is windows server 2003 R2 SPII
I have registered ASP.NET using aspnet_regiis.exe -i
I have enabled the web service extensions
I have created it as a virtual directory, and created the application
I have set the version of ASP.NET for my virtual directory to use
I have even created a new App Pool and given it administrator permissions.
I have run Auth Diag From Microsoft, i get and error from the authentication check, but it is blank
I have given full control to the everyone group for the folder
I have tried creating a new website with a different port, same problem
In fiddler i get the following repsonse when loading an asp.net page :
HTTP/1.1 504 Fiddler - Receive Failure
Content-Type: text/html
Connection: close
Timestamp: 09:43:01:0634
ReadResponse() failed: The server did not return a response for this request.
Looking at the IIS logs, i dont see any entries for any of the ASP.NET requests unless i turn on windows authentication, then i see
2011-04-12 08:13:23 W3SVC1 10.4.3.16 GET /test/Test.aspx - 80 - 10.2.16.17 Mozilla/4.0+(compatible;+MSIE+7.0;+Windows+NT+5.1;+Trident/4.0;+GTB6.6;+.NET+CLR+1.1.4322;+.NET+CLR+2.0.50727;+.NET+CLR+3.0.4506.2152;+.NET+CLR+3.5.30729;+InfoPath.2;+.NET4.0C;+.NET4.0E) - 401 2 2148074254
2011-04-12 08:13:26 W3SVC1 10.4.3.16 GET /test/Test.aspx - 80 - 10.2.16.17 Mozilla/4.0+(compatible;+MSIE+7.0;+Windows+NT+5.1;+Trident/4.0;+GTB6.6;+.NET+CLR+1.1.4322;+.NET+CLR+2.0.50727;+.NET+CLR+3.0.4506.2152;+.NET+CLR+3.5.30729;+InfoPath.2;+.NET4.0C;+.NET4.0E) - 401 1 0
HTML Pages serve up just fine, i'm stumped and about to get the server re-built as i have wasted long enough on this..
Any ideas :( ?
I ended up removing IIS and re-installign it, set the site back up and it worked fine...
Have you checked the windows event log for information that may lead to what is causing this?
You could also try removing the application role and adding it again encase there was an issue when originally setting it up.

Resources