Trouble with curl in php - php

So on my webserver, I am making a rest api that works perfectly when you visit the page and set get parameters in the URL. I am now trying to add a page where the php access the api and gets the value that it returns, like with the Wikipedia api. I have tested using curl and file_get_contents with multiple sites, and they both worked fine with low loading times. I have also accessed my api successfully from runscope, and it works fine. So why is it that when I try to read my file on my server from the same server, it just loads forever and times out? I have been looking all over for hours and I can't find anyone with this same issue. Should I just host my api elsewhere?

Related

503 in php file when making an API Call

I am having trouble with several php files.
The problem is when I try to access my WebApp in said php files it results in a 503 error. Both files have API calls to different services that have worked perfectly until yesterday. When I remove the API call from the code the WebApp opens with no problem. I called both API services and they are both getting the API requests made from my server with no problem.
I've already exhausted all options to fix this error but came up with no results.
Any help is valid.
Thank you so much.
I've tried to change PHP version, but as I said there is no problem with PHP. Removing the API call makes the webapp function normally.

Problems with using session data using nw.js with PHP web server

I am trying to convert my web game into a desktop app. Everything works except for the session data. I got websockets, images, audio, and all of that working. Great! But when I try to authenticate, it POSTs to the web server just fine, returns a successful authentication, and attempts to reload the page. However, upon page reload, the subsequent AJAX requests cannot get any of the $_SESSION values again.
I was able to find my PHPSESSID using win.cookies.getAll inside of the nw.js app, but I don't see how this helps me at all. Normally this is automatic when loading the webpage from the server. How do I fix this?

twitter api not loading tweet on server while works fine on local

I have created one twitter app through twitter api, but thing is that it works fine locally but when I took it to the server it doesn't work. Check this page, I can't conclude the reason. Although I changed the url in api settings as well.
I am using this plugin
I also doubt if it's curl base issue.

How to tackle IP blocks of an external website with proxies?

I am working on a scraping project to extract web data from a website. I have made a script to go through URLs and parse HTML contents and get the structured content into my database.The script was working fine,but recently the script got stuck and on investigation it was found that the target site is blocking our IP.
I am using PHP / CURL for this project,now I am getting a 403 error - Access Forbidden, error on a web request.
This has affected the working of my script,no pages could be retrieved from web request,every time I am getting an access restricting error.
I know there are lot of scraping etiquette's to be followed.Since we can't foresee how they had implemented the security features,I was confused on normalizing the web request calls.
I'm working on an amazon AWZ instance with an elastic IP,hence I am confused on when/whether they would lift the ban on my IP.
I have heard of rotating proxy methods to be used with scraping,such that the target server won't block you often.But I'm not sure about it's implementation.
Any help would be highly appreciated.I could provide any additional information if necessary.
sign in to the site to get an API id.
if you send a request to the site with API id and URL. it will send a request to the required URL with a random API and return a response.
just sign in and try it
signup

Facebook graph api doesn't response on real host but work fine in localhost

I had been using my written script for months and just from few days ago facebook stop responding ( it take forever to loads ) when the request is made from my host, but the same exact codes work fine when run in localhost.
I had been using curl method to get the group feed https://developers.facebook.com/docs/graph-api/reference/v2.0/group/members
file_get_contents("https://graph.facebook.com/489360131076423/feed/?access_token=APPID|SECRETCODE")
which still work fine in localhost but not in server. Then i also tried using "PHP SDK" method still having the same problem.
My setting in facebook developer is too seems to correct (it was working before too) as I have two domain allowed in App Domains setting which are "localhost" and "xxxxxxxx.im" ( my domain is .im not .com and obviously in xxxx i have my domain name written)
The question is
1. Can anyone suggest what could be the problem ?
2. Any suggestion for debugging this? because i don't get response at all. So no idea about any request error :(
Thanks :)
Try using ob_start(); function in the starting of page

Categories