Problem when you are getting json from some sites that needs
Response string
function toNumbers(d){var e=[];d.replace(/(..)/g,function(d){e.push(parseInt(d,16))});return e}function toHex(){for(var d=[],d=1==arguments.length&&arguments[0].constructor==Array?arguments[0]:arguments,e=””,f=0;fd[f]?”0″:””)+d[f].toString(16);return e.toLowerCase()}var a=toNumbers(“f655ba9d09a112d4968c63579db590b4”),b=toNumbers(“98344c2eee86c3994890592585b49f80”),c=toNumbers(“99efa97c59e1cf6146f7e801802ed6bc”);document.cookie=”__test=”+toHex(slowAES.decrypt(c,2,a,b))+”; expires=Thu, 31-Dec-37 23:55:55 GMT; path=/”; document.cookie=”referrer=”+escape(document.referrer); location.href=”http://zsoft.byethost8.com/login.php?ckattempt=1″;This site requires Javascript to work, please enable Javascript in your browser or use a browser with Javascript support
function toNumbers(d){var e=[];d.replace(/(..)/g,function(d){e.push(parseInt(d,16))});return e}function toHex(){for(var d=[],d=1==arguments.length&&arguments[0].constructor==Array?arguments[0]:arguments,e="",f=0;fd[f]?"0":"")+d[f].toString(16);return e.toLowerCase()}var a=toNumbers("f655ba9d09a112d4968c63579db590b4"),b=toNumbers("98344c2eee86c3994890592585b49f80"),c=toNumbers("99efa97c59e1cf6146f7e801802ed6bc");document.cookie="__test="+toHex(slowAES.decrypt(c,2,a,b))+"; expires=Thu, 31-Dec-37 23:55:55 GMT; path=/"; document.cookie="referrer="+escape(document.referrer); location.href="http://zsoft.byethost8.com/login.php?ckattempt=1";This site requires Javascript to work, please enable Javascript in your browser or use a browser with Javascript support
https://kyprizel.github.io/testcookie-nginx-module/
I solved like as Sebastian Mora answers here https://stackoverflow.com/questions/31912000/byethost-server-passing-html-values-checking-your-browser-with-json-string
- Getting the cookie key from the web browser. I used Google Chrome for it:
- From the Chrome menu in the top right corner of the browser, select Settings.
- At the bottom of the page, click Show advanced settings….
- Under Privacy, select Content settings….
- select All cookies and site data….
- Search for you website name. By searching “byethost” you’ll find it.
- Open the cookie named __test and copy the values of content, path and expires
- Setting the cookie on our Android app. On your code should be something like:
try
{
if(post == "POST")
{
HttpClient httpClient = new DefaultHttpClient();
HttpPost httpPost = new HttpPost(loginUrl);
httpPost.setEntity(new UrlEncodedFormEntity(para));
httpPost.setHeader("User-Agent","Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge/12.10240 ");
httpPost.addHeader("Cookie", "__test=THE_CONTENT_OF_YOUR_COOKIE_HERE; expires=Thu, 31-Dec-37 23:55:55 GMT; path=/");
HttpResponse httpResponse = httpClient.execute(httpPost);
HttpEntity httpEntity = httpResponse.getEntity();
is = httpEntity.getContent();
}
else if(post == "GET")
{
HttpClient httpClient = new DefaultHttpClient();
String paramString = URLEncodedUtils.format(para, "utf-8");
loginUrl += "?" + paramString;
HttpGet httpGet = new HttpGet(loginUrl);
httpGet.addHeader("Cookie", "__test=THE_CONTENT_OF_YOUR_COOKIE_HERE; expires=Thu, 31-Dec-37 23:55:55 GMT; path=/");
HttpResponse httpResponse = httpClient.execute(httpGet);
HttpEntity httpEntity = httpResponse.getEntity();
is = httpEntity.getContent();
}
}
My Solution
connection.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge/12.10240 ");
connection.setRequestProperty("Cookie", "__test=2ad4957fd60a8b74775f11b309b4496a; expires=Friday, 1 January 2038 at 01:55:55; path=/");//other any other
I had this same issue when i am creating a registration form in my android app.Where we have to place this android code?
have you got the solution?
I have got the same problem with infinityfree hosting