I'm jumping into Python/Django, and have been hitting some speed bumps. I'm a somewhat novice programmer. I know the basics, but haven't done anything more than create a PHP webform, and build very simple websites. I have a thousand questions about Django (most centering around Views and customizing the Admin, specifically as they relate to querying the DB), but I'll start with this seemingly simple one, and hopefully someone can help me out. In views.py, I begin with 'from django.http import HttpResponse'. I then create a boring function: def hello(request) return HttpResponse("Hello world") Seems simple enough, right?. While reading [the …

Member Avatar
Member Avatar
+0 forum 2

Hello, There is a post request coming to my portal and I am fetching IP address from the post request on my portal landing page(INDEX view in MVC) and saving in DB table. below is the code to fetch IP address. string Device_IP = ""; if (!string.IsNullOrEmpty(Request.ServerVariables["HTTP_VIA"])) { // ' using proxy // ' Return real client IP. Device_IP = Convert.ToString(Request.ServerVariables["HTTP_X_FORWARDED_FOR"]); } else { // 'not using proxy or can't get the Client IP // 'While it can't get the Client IP, it will return proxy IP. Device_IP = Convert.ToString(Request.ServerVariables["REMOTE_ADDR"]); } It is fetching IP address on my side but …

Member Avatar
+0 forum 0

i will be receiving JSON POST as mentioned on this web page https://sendgrid.com/blog/sendgrids-parse-api-parsing-incoming-email-is-now-faster-and-easier/ how do my application receive this request and process furthur??

Member Avatar
Member Avatar
+0 forum 3

I am trying to use a sms gateway app for android called SMSGateway with a http header request using curl as below; $curl_handle=curl_init(); curl_setopt($curl_handle, CURLOPT_URL,"http://192.168.1.2:9090/sendsms?phone=$phone&text=$message1&password=xxxxxxxx"); curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 10000); curl_setopt($curl_handle, CURLOPT_TIMEOUT,50000); curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl_handle, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.1; rv:36.0) Gecko/20100101 Firefox/36.0'); $query = curl_exec($curl_handle); if($query){echo "Message Sent to $phone !<br>";}else{echo "Message Not Sent to $phone !<br>";echo 'Curl error: ' . curl_error($curl_handle)."<br>";} curl_close($curl_handle); This works perfectly fine on my local system but it gets timed out when executing from server... I need to know what is wrong...is it a curl issue ? should i use file_get_contents ? Actually I did …

Member Avatar
Member Avatar
+0 forum 8

How does request processing works out from the perspective of a php developer? More than that I'm concerned with e.g. once request is parsed through.htaccess ,mapped to the file and respone is sent back. The mechanism of how this response gets sent back to the client is what I eagerly want to know ? Why? I'm developing a PHP script that needs to know what exactly is coming from the database to the client so that I can alter it in the middle. I cannot tweak the code of the developer as I have to make my script generic enough …

Member Avatar
Member Avatar
+0 forum 2

hi there, I have a hidden field in my page which i need to transfer to another page as request query string/paraameter. It works perfectly in IE and in chrome. When i try in Mozilla the value of the req string is always undefined. Can any one help me out. thanks in advance

Member Avatar
Member Avatar
+0 forum 7

I am having some trouble posting to website..I've tried posting to many different websites and get the same result.. An error message referencing the js on the page, asking if i want to continue.. Then the response i get is the form I am posting to, with all fields correctly filled in. It looks like data was posted and never submitted?? I can't figure out where it's going wrong, and any help would be greatly appreciated. Here is my code: using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using System.Net; …

Member Avatar
Member Avatar
+0 forum 5

Hello, I have a Ruby On Rails app online which uses devise authentication. I am trying to make an android app which make a request from ror app when a user try to log in (so the users can use same account from ror app). I heard that what I need is basic http authentication. Can you help me please with a functional example, or some useful links? All the examples found on the internet were useless. Thanks

Member Avatar
Member Avatar
+0 forum 1

hi. when a user request hits the ActionForm's validate method (struts)and bounces back, i'm loosing some request attributes that i had set for the page. In other words, if the user inputs some data that don't pass the validate method, the page comes back with a few request scope attributes missing. Is there a way to avoid that this happens? Thank you in advance

Member Avatar
Member Avatar
+0 forum 1

Hi, I have module that imports data from json file to hash. Json file is pretty big so I don't want loading to take place on every request because it takes some time. It would be best to do this just on server start. I have a class variable in module called "data" which I'd like to set only on server start and then I can access to it on every request with SomeModule.data (I use mattr_accessor). I tried to import data in application config.after_initlize method but id doesnt work - data persists only on first request and on second …

Member Avatar
Member Avatar
+0 forum 2

I am developing app where I need to capture an Information from Webpage after giving credentials automatically. Some how I managed to do Automatic login and redirection of page. Here is my code : HttpWebRequest req = (HttpWebRequest)WebRequest.Create("https://abcd.com.au/categories/A_dfn/sdf"); HttpWebResponse res = req.GetResponse() as HttpWebResponse; StringBuilder sb = new StringBuilder(); byte[] buf = new byte[10000]; Stream resStream = res.GetResponseStream(); string s = null; int c = 0; do { c = resStream.Read(buf, 0, buf.Length); if (c != 0) { s = ASCIIEncoding.ASCII.GetString(buf, 0, c); sb.Append(s); } } while (c > 0); string oldhead = "class=\"login_button\">"; string newhead = "class=\"login_button\"> <script type=\"text/javascript\">document.getElementById('btn').click()</script>"; …

Member Avatar
Member Avatar
+0 forum 2

Hi how do i create an application in ASP.net C# for HTTPWebRequest, HTTPWebResponse to send and get data back

Member Avatar
Member Avatar
+0 forum 3

Hi all. I have 2 pages: 1. that provides data from mysql in json encoding if a correct "key" is provided, in my case the "key" sent by method post should be "1". Link: http://semaffiliate.local/public/api/getemployees Code in Zend: public function getemployeesAction() { $key = $this->getRequest()->getPost('key'); if (isset($key)) { if ($key == 1) { $employeeModel = new Application_Model_DbTable_Employee(); $employees = $employeeModel->fetchAll()->toArray(); $res = array('status' => 'Success', 'settings' => $employees); } else { $res = array('status' => 'Error', 'message' => 'Access denied, invalid key supplied.'); } } else { $res = array('status' => 'Error', 'message' => 'Access denied, you must supply a …

Member Avatar
Member Avatar
+0 forum 3

Hi I am very new php propgramming. But I have done classic asp. I have a string request, eg www.xyz.com?test=1 In my php page, I would like to read test value. On my index.php, I have this code. <? $y=$_GET["test"]; ?> But I am getting error, Undefined index: test in index.php. I can see, when I call index page first time, I call just as www.xyz.com. Please can some help. Many thanks.

Member Avatar
Member Avatar
+0 forum 5

Hello everyone. I have a problem trying to develop a windows phone app as a university project. Part of it is to use google APIs. So I'm trying to make a test web request.My code is as follows: string api_request = "https://maps.googleapis.com/maps/api/place/textsearch/xml?query=restaurants+in+Sydney&sensor=true&key=AIzaSyDpXZSLtOeGLJcYwKKJs2yAAEdfLST0ZXs"; HttpWebRequest google_request = (HttpWebRequest)WebRequest.Create(api_request); HttpWebResponse google_response_file = (HttpWebResponse)google_response.GetResponse(); StreamReader google_response_datastream = new StreamReader(google_response.GetResponseStream()); As you can see I'm creating an HttpWebRequest object and I initialize it. However, when I try to get a response I create an HttpWebResponse object but the initializer method is not accessible. After some googling I find out that insted of the HttpWebResponse initializer …

Member Avatar
Member Avatar
+0 forum 8

Hello, I have a question regarding implementations of uploading a file from a browser to a server. I have currently two pages, page (1) is used to select the file. Using a form-submit section, the form is passed to page(2). Page (2) now gets a javabean, passing `request` to it. It manipulates the request to get the encoded date. This all works. However, running the code in the javabean is approximately 120 times slower than as a scriplet in a .jsp file. Any suggestions? Regards, Matthew

Member Avatar
+0 forum 0

I'm in a little bit of a panic. I have built my mobile website infrastructure based on a system of links like this: `http://sample.com/#home`, `http://sample.com/#reports`, etc. I am using HTML5 data-role for the first time. anyway, I have just discovered that this: `http://sample.com/#reports?say=hello` doesn't work! Or it isn't accessible by php anyway. Basically, when I do this: if(isset($_REQUEST['say'])) { if($_REQUEST['say'] == 'hello') { echo 'Hello World!'; } } Nothing happens. To clarify: php is working, because a simple echo displays fine. any ideas? I'm stuck at this point and can't move forward with my project. Thanks so much for any …

Member Avatar
Member Avatar
+0 forum 1

Hi, Can someone tell me how to make this. I have winform wich read from file and make post request to web. I want to have one textbox where i can put time betwen every request. for example: I run my app and read whole file with(1000rows) and 2sec delay after every row. I use now Thread.Sleep() now in code side and i must change it in code side every time if i want different value ... will be better to have options to change this on my form. Thank you

Member Avatar
Member Avatar
+0 forum 1

I would like to see a "Subscribe to Thread" feature added. There are occasions when I want to be notified if there are new postings to a thread, even when I feel I have nothing to contribute. I (generally) don't like posting unless I can make a contribution to the topic and currently (as far as I know) that is the only way to get email notifications of new posts.

Member Avatar
Member Avatar
+0 forum 5

Hello I am trying to make a friend request system and I have it so it displays all the friend request and at the end there is a button that says "Yes" and one that says "No" I would like the Yes button to change "0" to "1" and No to change "0" to "2" in the friend request table. So if you had multiple friend request I would like it to be displayed as John Smith - [Yes] - [No] Sam Young - [Yes] - [No] Mary Berry - [Yes] - [No] I would like it so you can …

Member Avatar
+0 forum 0

Hello people, I have created a game for windows7 platform and want to put it on the internet and on cd for a small fee. I was wondering if anyone knows a good copy protection mechanism which i can use. I already find a few anti copy protection mechanisms, does anyone know these systems, or maybe do you know a better system instead? - lockPE doesnt seem to work for me because it causes errors when I try the program - the tool from logicprotect.com is way too expensive, i need something familair, but cheaper. - exesecure.com offers an exesecure …

Member Avatar
Member Avatar
+0 forum 3

I have 4 buttons on my page and I want each one to make a different http post request on clicking them. I tried using form for each of them but that make them appear in different lines but I want all of them to be horizontally aligned. Is there any way through Javascript to do it without using form. And also tell me what exactly I need to write in button tag

Member Avatar
+0 forum 0

Hello, I have this weird issue with my simple upload form for different files. [CODE] <form enctype="multipart/form-data" action="mesaje_furnizori.php" method="GET"> <table> <tr><td align="right">Va rugam selectati &raquo; </td><td><?php echo $selectare; ?></td></tr> <tr><td align="right"><td><input type="file" name="file" id="file"/></td></tr> <tr><td align="right" colspan="2">Fisiere suportate (.*gif,*.jpg,.*jpeg,.*png,.*bmp,.*doc,.*docx,.*xls,.*xlsx) Marimea maxima de: <strong>5MB</strong></td></tr> <tr><td colspan="2"><textarea name="mesajTrimis" cols="70" rows="15"></textarea></td></tr> </table> <input type="hidden" name="trimis" value="ok" /> <input type="submit" value="Trimite"/> </form> [/CODE] The file is passed into my TMP. [CODE]Array ( [file] => Array ( [name] => mesaje.png [type] => image/png [tmp_name] => /tmp/phpvdjnGr [error] => 0 [size] => 4009 ) )[/CODE] The weird part is when I print_r($_REQUEST); The file is not …

Member Avatar
Member Avatar
+0 forum 7

[B]Environment[/B] Development: Amazon EC2 instance. Operational: Unknown at this time [B]Scenario[/B] This is a *nix question but things start out in php, so please bear with me. I'm trying to get php script (php_script_1) to to run another php script (php_script_2) in the background. This will allow php_script_1 to complete and return (with a suitable message to the user), having kicked off the lengthy php_script_2. The output of php_script_2 will be cached (in a database) for future use. [B]Progress to date[/B] I have identified php's shell_exec() and a neat little "run_in_background" function wrapper to issue commands. [CODE] function run_in_background($Command, $Priority …

Member Avatar
Member Avatar
+0 forum 3

Hi all :) I got some serius problem that I've tried to solve in almost two days. I've try to send a request to a URL from a android app, [URL="http://web.hjalmar.nu/~morgan/webpage/test.php"]http://web.hjalmar.nu/~morgan/webpage/test.php[/URL]. the problem is, that it isn't working. ANDROID-file [CODE]package morgan.request.test; import java.io.BufferedReader; import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.IOException; import java.io.InputStreamReader; import java.net.MalformedURLException; import java.net.URL; import java.net.URLConnection; import android.app.Activity; import android.os.Bundle; import android.widget.*; public class TestingrequestActivity extends Activity { /** Called when the activity is first created. */ Button post; EditText txt; TextView outputt; public String postData() { String result = ""; try { URL url = new URL("http://web.hjalmar.nu/~morgan/webpage/test.php"); URLConnection …

Member Avatar
Member Avatar
+0 forum 4

I describe my problem with following simple example. [CODE] function show(str) { if (window.XMLHttpRequest){ xmlhttp=new XMLHttpRequest(); } else xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("txtHint").innerHTML=xmlhttp.responseText; } } xmlhttp.open("GET","data.php?q="+str,true); xmlhttp.send(); } [/CODE] here,i am getting some responsetext or result from data.php file through my request. In my responsetext, i've used some input fields, buttons. How can i add functionality to that fields, which are fetching from external file(eg: data.php) through ajax request. Can anyone plz help me?

Member Avatar
Member Avatar
+0 forum 3

I have this bit which I have actually only tried in Google Chrome, but it works finte there: Im using ajax to get data from the Db, when popuating one select list based on whats selected from another: But in Internet Explorer 9, it doesnt work: [CODE] // JavaScript Document function MakeRequestObject(){ var xmlhttp=false; try { xmlhttp = new ActiveXObject('Msxml2.XMLHTTP'); } catch (e) { try { xmlhttp = new ActiveXObject('Microsoft.XMLHTTP'); } catch (E) { xmlhttp = false; } } if(!xmlhttp && typeof XMLHttpRequest!='undefined'){ xmlhttp = new XMLHttpRequest(); } return xmlhttp; } function showUser(cat){ var xmlhttp=MakeRequestObject(); xmlhttp.open('GET', 'ajax/selectbox.php?page_position='+cat, true); xmlhttp.onreadystatechange=function(){ if(xmlhttp.readyState==4 …

Member Avatar
Member Avatar
+0 forum 1

Hi All, I have a problem on one of my site where I have Quintum VOIP gateways in 2 separate buildings that are connected with a Fiber link. When running the ping command I loose packets to the Quintums but not to PC's. Today their Exchange server went down and for a while I had no packet loss. When removing the Quintums from their network and putting them on a separate switch, I get no packet loss.We have moved the Quintums to different switches, replaced the patch leads. Any help will be greatly appreciated. Thank you Max

Member Avatar
Member Avatar
+0 forum 2

Hi, Please help me out. 1. Getting HYPERLINK value from page1 and saving in page2 using GET method.($re=$_GET[variable];) 2. Passing this value in -> select query 3. Displaying my output - correctly(in each and every value, there is an SUBMIT button.) 4. My Form Action is page2 itself. 5. Due to this, by submitting the form, my GET method value becomes NULL. 6.Displaying my output - incorrectly(selecting all NULL field values in WHERE CLAUSE) Please help me out.Thanks in advance

Member Avatar
Member Avatar
+0 forum 15

I just took almost all the graphics on my website that are used often in the design and put them into a CSS sprite. Because of the varying sizes this created large area of the new image file that had nothing in them. The result of this was a new CSS sprite that was about 80KB when all the original images together were only about 48KB. I can tell how the webpage is actually loading slower now. Is it worth keeping the sprites to minimize HTTP requests? Does size matter more or the amount the server is contacted to download …

Member Avatar
+0 forum 0

The End.