Hi i'm developing an android application in android studio in java that send sign up information to the server, i'm using volley library to make HTTP requests(GET method) and for my server side i'm coding with php to get information from client side. my issue is when i send persian characters to the server by android devices with api 16 or lower the server get requests parameters content like this : ???? , i don't have this problem when i make requests from devices with api 17 and higher  i tried to send sign up information in JSON format but it did not work. my php version 5.3.5 ,mySql 5.5.8 and android studio version 3. this is my android client side code :   private void sendDataToServer() {      SendDataObject dataObject = new SendDataObject();     dataObject.setName(edtName.getText().toString());     dataObject.setFamily(edtFamily.getText().toString());     dataObject.setCodeMelli(edtCodeMelli.getText().toString());     dataObject.setOstan(edtOstan.getText().toString());     dataObject.setID(ID);          String url = SplashActivity.SERVER_IP + "sign_up_users.php?name=" + edtName.getText()             +             "&amp;family=" + edtFamily.getText().toString().trim() +             "&amp;codeMelli=" + edtCodeMelli.getText().toString().trim() +             "&amp;ostan=" + edtOstan.getText().toString().trim() +             "&amp;ID=" + ID;       StringRequest getRequest = new StringRequest(Request.Method.GET, url,             new Response.Listener&lt;String&gt;() {                 @Override                 public void onResponse(String response) {                     if (response.toString().equals("true")) {                          SplashActivity.USER_ID = ID;                          Intent intent = new Intent(SignUpActivity.this, MainActivity.class);                         startActivity(intent);                         setSharedPrefs();                         overridePendingTransition(R.anim.slide_i_left,R.anim.slide_i_right);                     }                     else {                         NoInternetDialog cdd = new NoInternetDialog(SignUpActivity.this);                         cdd.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));                         cdd.show();                     }                 }             },             new Response.ErrorListener() {                 @Override                 public void onErrorResponse(VolleyError error) {                  }             }     );     getRequest.setRetryPolicy(new DefaultRetryPolicy(18000, DefaultRetryPolicy.DEFAULT_MAX_RETRIES, DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));     RequestQueue requestQueue = Volley.newRequestQueue(SignUpActivity.this);     requestQueue.add(getRequest);    }   and my php server side code sign_up_users.php :   &lt;?php     include 'connect.php';       if (isset($_GET["name"]) &amp;&amp; isset($_GET["family"]) &amp;&amp; isset($_GET["codeMelli"]) &amp;&amp; isset($_GET["ostan"]) &amp;&amp; isset($_GET["ID"])) {         $name = $_GET["name"];         $family = $_GET["family"];         $codeMelli = $_GET["codeMelli"];         $ostan = $_GET["ostan"];         $ID = $_GET["ID"];             $stmt = $conn-&gt;prepare("UPDATE users SET name=:name ,family=:family, validation_status=1, codeMelli=:codeMelli , ostan=:ostan WHERE ID=:ID");          $stmt-&gt;bindParam(':name',$name);         $stmt-&gt;bindParam(':family',$family);         $stmt-&gt;bindParam(':codeMelli',$codeMelli);         $stmt-&gt;bindParam(':ostan',$ostan);         $stmt-&gt;bindParam(':ID',$ID);         $res = $stmt-&gt;execute();          $stmt = null;          if ($res) {             echo 'true';         }         else {             echo 'false';         }      }     else {         echo 'error_parameters';     } ?&gt;
326
I'm setting up a new server and want to support UTF-8 fully in my web application. I have tried this in the past on existing servers and always seem to end up having to fall back to ISO-8859-1.  Where exactly do I need to set the encoding/charsets? I'm aware that I need to configure Apache, MySQL, and PHP to do this — is there some standard checklist I can follow, or perhaps troubleshoot where the mismatches occur?  This is for a new Linux server, running MySQL 5, PHP, 5 and Apache 2.
73621
Is there any way to create the query parameters for doing a GET request in JavaScript?  Just like in Python you have , which takes in a dictionary (or list of two tuples) and creates a string like 'var1=value1&amp;var2=value2'.
16373
How do I pass have a Javascript script request a PHP page and pass data to it? How do I then have the PHP script pass data back to the Javascript script?  client.js:  data = {tohex: 4919, sum: [1, 3, 5]}; // how would this script pass data to server.php and access the response?   server.php:  $tohex = ... ; // How would this be set to data.tohex? $sum = ...; // How would this be set to data.sum? // How would this be sent to client.js? array(base_convert($tohex, 16), array_sum($sum))
107750
I'm getting the following GET requests in my apache logs:  109.230.251.14 - - [29/Mar/2011:16:28:18 +0100] "GET http://209.191.92.114/config/pwtoken_get?login=jackmcphee232&amp;src=ygodgw&amp;passwd=e59e2240415e6f1aba3da72b8f189f4e&amp;challenge=9TbU_9yfZhKmzlHtK9X4OkQlesTH&amp;md5=1 HTTP/1.0" 404 1226 "-" "-"   Any idea what it could be and how is that possibly a get request? That IP address seems to point to Yahoo! I'm very confused.
19142
Our team had met a problem that when we update the API version to 46, the UserInfo.isCurrentUserLicensed method seems missing. We have reported an issue on the developer forums.   And I'd like to post it here to see whether or not other guys face the same issue with us.  Thansk
60142
I am trying to set the status code to 429 for Too many request using the code below:  if(Limits.getQueries() &lt; Limits.getLimitQueries()){               upsert UpdateData;               }               else if((Limits.getQueries() &gt;= Limits.getLimitQueries()))               {                   RestContext.response.statusCode = 429;                   UpdateError[] err = new UpdateError[]{                    new UpdateReturnError(UpdateData.Id, 'Too many Requests', 'Error updating MessageID ' + msg.MessageId)                 };                 RestContext.response.responseBody = Blob.valueOf(JSON.serialize(err));                 RestContext.response.addHeader('Content-Type', 'application/json');                 break;               }             }   I am getting the following error in the raw response:    Can someone help me out with this?
49986
Am try to implement data from database using AJAX based on a drop down list in WordPress. The codes returning 400 bad request in the console. I am hosted the page as localhost.  Here is my theme's functions.php //I changed the Code    function my_enqueue_scripts() {    wp_enqueue_script('jquery'); } add_action('wp_enqueue_scripts', 'my_enqueue_scripts');  function fetchData(){     global $wpdb;      // this can be improved     $catId = isset($_REQUEST['catId']);     if($catId){         $result_data = $wpdb-&gt;get_results("SELECT * FROM  sub_category where categor_id = '".$catId."'");         foreach ($result_data as $data) {             echo "&lt;option value='".$data-&gt;id."'&gt;'".$data-&gt;sub_category_name."'&lt;/option&gt;";         }      }     die(); }  // add your ajax action to authenticated users only add_action('wp_ajax_fetch_data','fetchData');   Am also adding the jQuery part here:  &lt;script type="text/javascript"&gt;  jQuery(document).ready( function(){    jQuery('#category').on('change',function (){       console.log("start1");       var catId = document.getElementById('category').value;       console.log(catId);       jQuery.ajax({         type: 'POST',         url: "&lt;?php echo admin_url( 'admin-ajax.php' ); ?&gt;",         data: {             'key':catId,             'action': "fetch_data" // very important         },         success : function (data) {                  jQuery('#sub_cat').html(data);                 }       });   }); });  &lt;/script&gt; &lt;form  method="post" name="myform" id="myform"&gt; &lt;table width="200" border="0" cellpadding="10"&gt;   &lt;tr&gt;     &lt;th scope="col"&gt;&amp;nbsp;&lt;/th&gt;     &lt;th scope="col"&gt;&amp;nbsp;&lt;/th&gt;     &lt;th scope="col"&gt;&amp;nbsp;&lt;/th&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;&lt;label&gt;Category&lt;/label&gt;&lt;/td&gt;     &lt;td&gt;&lt;select name="category" id="category" &gt;           &lt;option value=""&gt;Select the category&lt;/option&gt;            &lt;?php                 global $wpdb;                 $result_fromDB = $wpdb-&gt;get_results("SELECT * FROM `category`");                 foreach ($result_fromDB as $cat) {                        echo "&lt;option value='".$cat-&gt;id."' selected&gt;".$cat-&gt;name."&lt;/option&gt;";                 }            ?&gt;         &lt;/select&gt;     &lt;/td&gt;     &lt;td&gt;&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;&lt;label&gt;Sub Category&lt;/label&gt;&lt;/td&gt;     &lt;td&gt;&amp;nbsp;         &lt;div id="fetch_data"&gt;&lt;select name="sub_cat" id="sub_cat"&gt;         &lt;option value=""&gt; Select Sub category&lt;/option&gt;  &lt;!--Here I want to return the data--&gt;     &lt;/select&gt;&lt;/div&gt;     &lt;/td&gt;   &lt;/tr&gt; &lt;/table&gt;  &lt;/form&gt;   Remembering that I am using internal scripts, Please give a solution.
13332
I am trying to use a  as input and then creating a query with it - so I need a .    I was surprised to find that it couldn't do the conversion implicitly or explicitly - but I don't even know how I would do this, as the Java API is still fairly new to me.
30749
I have set up an apex class as a REST endpoint for an HTTP GET request that an external system is sending. We're having some trouble with it and they want me to send them the request detail. How do I get the full URL with the querystring appended so I can System.debug it and send it to them?  Also are there any other useful methods that return information I/they can use?  The REST class has one HTTPGet method:  @RestResource(urlMapping='/smscallback') global class SMSCallbackController {     @HttpGet     global static String doGet() {      System.debug(RestContext.request.requestBody);      String g_transactionId = RestContext.request.params.get('tranid');     String g_messageGuid = RestContext.request.params.get('messageguid');     String g_recipient = RestContext.request.params.get('recipient');     String g_statusId = RestContext.request.params.get('statusid');     String g_datetime = RestContext.request.params.get('datetime');     String g_clientRef = RestContext.request.params.get('clientref');      System.debug('Transaction ID: ' + g_transactionId);     System.debug('Message GUID: ' + g_messageGuid);     System.debug('Recipient: ' + g_recipient);     System.debug('Status: ' + g_statusId);     System.debug('Date/Time: ' + g_datetime);     System.debug('Security Ref: ' + g_clientRef);      SMS_Message__c relatedRecord;      //check record exists     try {         relatedRecord = [SELECT Transaction_ID__c, Recipient_Phone__c, Salt__c FROM SMS_Message__c WHERE Transaction_ID__c = :g_transactionId AND Recipient_Phone__c = :g_recipient LIMIT 1];     } catch (Exception e) {         System.debug(e);          RestResponse res = RestContext.response;         res.addHeader('Content-Type', 'application/json');          String jsonResponse = '';         res.statusCode = 500;         jsonResponse = '{"response": {"status": "Failed", "message":"Server Error."}}';         res.responseBody = blob.valueOf(jsonResponse);          return 'No matching transaction found!';     }      //check hash     g_clientref = EncodingUtil.urlDecode(g_clientref, 'UTF-8');      String valueToHash = relatedRecord.Recipient_Phone__c + String.valueOf(relatedRecord.Salt__c);     Blob b = Crypto.generateDigest('SHA-256', Blob.valueOf(valueToHash));      if (g_clientref == EncodingUtil.base64Encode(b)) {         //if hash matches, set delivery code and received time         relatedRecord.Delivery_Status_Code__c = g_statusId;          String dtStr = g_datetime + '+01:00';         System.debug('Date/Time string to save:' + dtStr);         Datetime dt = (Datetime)json.deserialize('"' + dtStr + '"', datetime.class);         System.debug('Date/Time to save:' + String.valueOf(dt));         System.debug('hour(): ' + dt.hour());         System.debug('hourGmt(): ' + dt.hourGmt());         relatedRecord.Receipt_Received_At__c = dt;          relatedRecord.Message_GUID__c = g_messageGuid;         update relatedRecord;          RestResponse res = RestContext.response;         res.addHeader('Content-Type', 'application/json');          String jsonResponse = '';         res.statusCode = 200;         jsonResponse = '{"response": {"status": "Success", "message":"Received."}}';         res.responseBody = blob.valueOf(jsonResponse);          return 'Message details successfully updated!';     } else {         //hash does not match         return 'Security does not match!';     }               }   }
114531
I need to serialize a list of SObject without omission null values. This string I need for a later usage in JavaScript. Structure is crucial, because I need to construct a table out of it. The structure is very dynamic. Different SObjects may lead to different fields and therefore different columns. Missing values will corrupt all the output and are unacceptable.  As it stands, in current versions JSON.serialize() will not output null values. There are already some questions about this raised, but either the answers there are incorrect or I'm doing something wrong to apply them right:       As far as I understand, Apex version 28.0 and newer should have no null values and version 27.0 and older should have them. But I can't make it work. There was an issue that the JSON.serialized() was not versioned right but as to  it should be working now.   So I've created this helper-class:  public class elfApi27 {      public static string dump0(Object o) {         return system.JSON.serializePretty(o);      } }   Setting the version like this in the xml  &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"&gt;     &lt;apiVersion&gt;27.0&lt;/apiVersion&gt;     &lt;status&gt;Active&lt;/status&gt; &lt;/ApexClass&gt;   tested it via execute anonymous like this (consider xl.log as system.debug)  Account a = new Account(name='test'); xt.log( elfApi27.dump0(a) );   I have tried all the versions from 32.0 down to 24.0 but the output stays rock-solid like this:  DB Callout Profile Code Escape   32.0 APEX_CODE,WARN;APEX_PROFILING,WARN;CALLOUT,WARN;DB,WARN;SYSTEM,WARN 19:09:02.119 (119823175)|EXECUTION_STARTED 19:09:02.119 (119833395)|CODE_UNIT_STARTED|[EXTERNAL]|execute_anonymous_apex 19:09:02.132 (132802344)|USER_DEBUG|[230]|WARN|"{    "attributes" : {       "type" : "Account"    },    "Name" : "test" }" 19:09:02.132 (132848199)|CODE_UNIT_FINISHED|execute_anonymous_apex 19:09:02.134 (134336841)|EXECUTION_FINISHED    Am I misinterpreting the answers?  Is there any way to have a full verbose serialization of objects?
10311
I'm trying to integrate Kraken.io into our org so I can have Salesforce queue up image optimization jobs that our employees upload. Kraken.io requires that the requests post a multipart/form-data body which contains a JSON parameter and the file. I'm porting code from C# where I could just write to the request stream, but in APEX with the HttpRequest class this doesn't seem to be possible. How can I go about creating a request that can do this?
13909
When encoding a query string to be sent to a web server - when do you use escape() and when do you use encodeURI() or encodeURIComponent():  Use escape:  escape("% +&amp;=");   OR  use encodeURI() / encodeURIComponent()  encodeURI("http://www.google.com?var1=value1&amp;var2=value2");  encodeURIComponent("var1=value1&amp;var2=value2");
27271
I'm using the following syntax for my code snippets  \begin{minipage}{\textwidth} \begin{lstlisting}[caption=&lt;something&gt;, label=&lt;something&gt;] The REST Endpoint URL     is http://api.flickr.com/services/rest/  To request the flickr.test.echo service,     invoke like this:    http://api.flickr.com/services/rest/       ?method=flickr.test.echo&amp;name=value  By default, REST requests will send a REST response. \end{lstlisting} \end{minipage}   and I would like to have  \begin{code}[&lt;caption&gt;, &lt;label&gt;] ... code ... \end{code}   which would behave exactly the same.   So I tried this thing but it won't compile and I can't spot the problem  \newenvironment{code}[2][]%     {         \minipage{\textwidth}          \lstset{             basicstyle=\ttfamily,             breaklines=true,             captionpos=b,             frame=bottomline,             extendedchars=true         }         \begin{lstlisting}[caption=#1, label=#2]     }     {         \end{lstlisting}         \endminipage     }   Error when running pdflatex  ! Package inputenc Error: Unicode char \u8:�\expandafter not set up for use with LaTeX.  See the inputenc package documentation for explanation. Type  H &lt;return&gt;  for immediate help.
70061
I am new to salesforce. I created an apex class and exposed it as a Rest service. I want to post some parameters to that service from an external client(not vf page). One way is I append it to the url something like myservice/functionName/parameter1/parameter2. But I want to send them as GET/POST parameters. Does anyone know how to read those parameters in the apex class?
47668
I am tasked with writing an authentication component for an open source JAVA app.  We have an in-house authentication widget that uses https.  I have some example php code that accesses the widget which uses cURL to handle the transfer.    My question is whether or not there is a port of cURL to JAVA, or better yet, what base package will get me close enough to handle the task?   Update:  This is in a nutshell, the code I would like to replicate in JAVA:  $cp = curl_init(); $my_url = "https://" . AUTH_SERVER . "/auth/authenticate.asp?pt1=$uname&amp;pt2=$pass&amp;pt4=full"; curl_setopt($cp, CURLOPT_URL, $my_url); curl_setopt($cp, CURLOPT_RETURNTRANSFER, 1); $result = curl_exec($cp); curl_close($cp);   , I think you're on the right track, I think I'm going to end up using HttpsURLConnection and then picking out what I need from the response.
80033
On backend I am using java. I have a game in HTML5; when user completes it I sends an Ajax call to save the score to database. Now, someone can easily use tools like Fiddler and firebug to modify this ajax request and send a much better score to the server. How do I make sure that user cannot manipulate scores !
65851
Is there a well-supported, common behavior that I can expect if I do something like this in HTML:  &lt;form method="get" action="/somePage.html?param1=foo&amp;param2=foo"&gt;   &lt;input name="param2"&gt;&lt;/input&gt;   &lt;input name="param3"&gt;&lt;/input&gt; &lt;/form&gt;   Seems like this sort of thing is inherently ridiculous, but I've seen it used here and there and I was wondering what on Earth the expected behavior should be.  Are browsers smart enough to tack on "&amp;param2=whatever&amp;param3=whatever" to the action, or do they just throw in a second question mark?  Or what?  Are there cases where this is actually the right way to do things?