Search Results

Search found 42698 results on 1708 pages for 'php in array'.

Page 171/1708 | < Previous Page | 167 168 169 170 171 172 173 174 175 176 177 178  | Next Page >

  • Need help with cURL and POSTing in PHP

    - by alex
    I need to post to a payment gateway. The example PHP script for the gateway simply sets the XML like this curl_setopt($ch, CURLOPT_POSTFIELDS, $xmlRequest); // $xmlRequest is just a string of XML In all of my experience, generally you need to use an array with key/values or a string similar to GET params. I am using Kohana, and tracked down a cURL module. It accepts the POST key/values as an array only. Now, I could ditch the module and throw some cURL straight in, but I am using this module fine all throughout the site, so would prefer to use it here. So, my question is, how does that first one work? Does it just POST the whole thing without any named key? Is there a default key I could use for an array to get the module to work?

    Read the article

  • PHP: form input field names containing square brackets like field[index]

    - by gidireich
    Hi, I've seen lot of code that handle forms, which creates input fields with names containing square brackets. I understand that this is being somehow converted to PHP arrays when a PHP script examines the $_POST variable. My questions about this: What is the mechanism behind? At which point this names that merely contain brackets are converted to arrays? Is this a feature of the HTPP protocol? Of web servers? Of the PHP language? Continuing the previous question, is this a commonly used hack or a normal programming tool? What are (all) the rules of using brackets in input field names? Can multidimensional arrays be created this way? Thanks, Gidi

    Read the article

  • PHP exec() hangs, Error 500

    - by MRX_II
    So, my plan is to make small thumbnails of URL's with PHP and IECapt. IECapt works well, a nice command line tool, gets the full sized image of specified URL in 1 to 4 seconds. But my problem is to execute it trough PHP. This is the code I've trying to get working: exec('IECapt.exe ' . escapeshellarg($URL) . ' ' . escapeshellarg($Filename)) $URL is of course the URL, and $filename is a simplified version of the URL. Sometimes I get the IECapt to snap the image(trough PHP), but it takes awfully long (30-60s), and in the end I always get a 500-error, with no error messages to tell me what's wrong. Both variables are fine, they work manually with commandline: IECapt http://google.com Google.png My server set-up is IIS7 and PHP5.2.9, if relevant. (Windows Vista, all on my personal computer, so full access.) Any ideas?

    Read the article

  • Determining Terminal lines/cols via PHP CLI

    - by eFrane
    I know that it is quite easy to figure out a terminal's size parameters via the stty -a command. When using local CLI PHP scripts, there is no problem at all on grabbing that output via system() or so. But I am trying the same thing via a php script started from an ssh command. Sadly, all that stty ever returns is: stty: standard input: Invalid argument. The calling code is: exec('stty -a | head -n 1', $query); echo $query[0]; So the question is: If I can output to the terminal and read input from it (e.g. can fread() from STDIN and fwrite() to STDOUT in PHP, shouldn't stty also have valid STDIN and STDOUT?

    Read the article

  • Twitter oauth php problems

    - by Patrick Gates
    I'm writing some backend script for a twitter app and heres how it's going On the app you click a button that sends you to login.php on my server which logs into my database connects to twitter with my consumer key and secret: $to = new TwitterOAuth($consumer_key, $consumer_secret); $tok = $to->getRequestToken(); $request_link = $to->getAuthorizeURL($tok); and then writes the token and secret to the database, sets a session equal to the id in the database of the token and secret and then redirects to the "$request_link" You then go through the process of logging in and such on twitter and it redirects you to callback.php on my server Callback.php consists of logging into the database again, getting the new token and secret, and then writing the new token and secret to the database and then prompts you to go back to the app Then on the app, all I'm trying to do is access the basic credentials$to->get('account/verify_credentials') and it keeps coming back "could not authenticate you" What am I doing wrong?? Thank you for all the help :)

    Read the article

  • Wrapping 3 objects or less inside a while / foreach in PHP

    - by DarkGhostHunter
    Simple question. I have an array of 21 elements, and show every three of them inside a <div> block. The code is something like this: <?php $faces= array( 1 => 'happy', 2 => 'sad', (sic) 21 => 'angry' ); $i = 1; foreach ($faces as $face) { echo $face; $i++; } ?> The problem lies when this array doesn't have 21 elements, sometimes it gets 24, an other times 17. How I wrap every three of them, and wrap alone the rest? I came up with using switch and case, but that works only when there are 21 elements only. I think I could count them beforehand and put a closing in the last one (even if it is a group of one element).

    Read the article

  • php cURL POST how to follow location

    - by One Stuck Pixel
    I am in a bit of a rut with a cURL issue. The post works greate, the data is POSTED just fine and received ok, but the url of the posted page never appears in the browser after the cURL session is executed, for example look at the following code: $ch = curl_init("http://localhost/eterniti/cart-step-1.php"); curl_setopt($ch, CURLOPT_HEADER, false); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, "error=1&em=$em&fname=$fname&lname=$lname&email1=$email1&email2=$email2&code=$code&area=$area&number=$num&mobile=$mobile&address1=$address1&address2=$address2&address3=$address3&suburb=$suburb&postcode=$postcode&country=$country"); curl_exec($ch); curl_close($ch); The post works fine and I am taken to the cart-step-1.php where I can process the posted data, HOWEVER the location in the URL address bar of the browser remains that of the script page, in this case proc_xxxxxx.php Any ideas how to get the URL address to reflect the page I am actually POSTED to? Thanks a mill

    Read the article

  • Securely using exec with PHP to run ffmpeg

    - by Venkat D.
    I would like to run ffmpeg from PHP for video encoding purposes. I was thinking of using the exec or passthru commands. However, I have been warned that enabling these functions is a security risk. In the words of my support staff: The directive 'disable_functions' is used to disable any functions that allow the execution of system commands. This is for more security of the server. These PHP functions can be used to crack the server if not used properly. I'm guessing that if exec is enabled, then someone could (possibly) execute an arbitrary unix command. Does anyone know of a secure way to run ffmpeg from PHP? By the way, I'm on a dedicated server. Thanks ahead of time!

    Read the article

  • PHP pass variable after form is submitted

    - by user342391
    I have a form that posts to process.php. Process.php send all the data to mysql then returns back to the page using: <?php header("Location: /campaigns"); ?> On the page it returns to I want to display a message saying form submitted. Can I post a variable to the Location: /campaigns. And use the variable to display the message (or modal box)? and if so what would be the best way to do it?

    Read the article

  • Help with algorithm to determine phrase occurrence in string in PHP

    - by Will M.
    I have an array of phrases (max 2 words) like $words = array('barack obama', 'chicago', 'united states'); and then I have a string like: $sentence = "Barack Obama is from Chicago. Barack Obama's favorite food it pizza."; I want to find/create an efficient algorithm that would return the number of occurrences of the words in the array $words in the string $sentence. In this case it would be: 'barack obama' => 2 'chicago' => 0 How can I built this?

    Read the article

  • convert Bash command to php

    - by Keverw
    This is the bash command echo -n x && (echo 618cf954-6576-491d-8ac6-a1b888c4705d |xxd -r -p |openssl base64|tr '/+' '_-') This is my php <? $uuid = "618cf954-6576-491d-8ac6-a1b888c4705d"; $voiceid = "x" . $uuid; $voiceid = base64_encode($voiceid); $voiceid = str_replace("+", "-", $voiceid); $voiceid = str_replace("/", "_", $voiceid); echo $voiceid; ?> The bash gives the right output, the php one isn't. I'm not sure what i need to do deferent in php.

    Read the article

  • How to debug PHP with netbeans and Xdebug

    - by Jon Winstanley
    I have recently tried to get going with Netbeans 6.5 after it rated so highly in the IDE review by Smashing magazine. http://www.smashingmagazine.com/2009/02/11/the-big-php-ides-test-why-use-oneand-which-to-choose/ My main reason for switching from Notepad++ is that I'd like to be able to debug my code and set through it. I have followed the instructions about how to install xdebug from both the vendor http://xdebug.org/ and the netbeans web site. http://www.netbeans.org/kb/docs/php/debugging.html#gettingReady but to no avail. How is it done, has anyone else got debugging working in netbeans? (My setup is: Windows XP, Wamp server 2.0, PHP 5, Netbeans 6.5.1)

    Read the article

  • PHP: Accessing an object property with a variable.

    - by Peter
    Let's assume I have an array of object properties I'd like to access: $properties = array('foo', 'bar'); I'd like to loop through the object and access these properties dynamically (specifically, I'm trying to dynamically handle missing JSON elements based on an array of expected elements): foreach ($data as $item) { foreach ($properties as $property) { if (empty($item->{$property})) { // Do something } } } Each $item in $data should have the properties 'foo' and 'bar'. If empty(), I'll handle them. I'm trying to get the loop (in line 3) to access $item-{'foo'} and $item-{'bar'}, but it's not working. Any idea why? Thanks!

    Read the article

  • PHP include(): File size & performance

    - by Tom
    An inexperienced PHP question: I've got a PHP script file that I need to include on different pages lots of times in lots of places. I have the option of either breaking the included file down into several smaller files and include these on a as-needed basis... OR ... I could just keep it all together in a single PHP file. I'm wondering if there's any performance impact of using a larger vs. smaller file for include() in this context? For example, is there any performance difference between a 200KB file and a 20KB file? Thank you.

    Read the article

  • Force freeing memory in PHP

    - by DBa
    Hi everybody, in a PHP program, I sequentially read a bunch of files (with file_get_contents), gzdecode them, json_decode the result, analyze the contents, throw the most of it away, and store about 1% in an array. Unfortunately, with each iteration (I traverse over an array containing the filenames), there seems to be some memory lost (according to memory_get_peak_usage, about 2-10 MB each time). I have double- and triplechecked my code, I am not storing unneded data in the loop (and the needed data hardly exceeds about 10MB overall), but I am frequently rewriting (actually, strings in an array). Apparently, PHP does not free the memory correctly, thus using more and more RAM until it hits the limit. Is there any way to do a forced garbage collection? Or, at least, to find out where the memory is used? Thanks in advance, Dmitri

    Read the article

  • PHP PDO Username Availability Checker

    - by John Bernal
    I'm building a registration page that uses JQuery's validator plugin to validate the form. For the username, i used the remote method. So here's my jquery+html code: fiddle And here's Available.php: <?php $usr = $_POST["username"]; $link = new PDO('mysql:***;dbname=***;charset=UTF-8','***','***'); $usr_check = $link->prepare("SELECT * FROM Conference WHERE Username = :usr"); $link->bindParam(':usr', $usr); $usr_check->execute(); if($usr_check->rowCount()>0) echo "false"; else echo "true"; ?> So I have a test account in my database with the username: user. When I tried to submit my form with the same username, it didn't display the error saying "username taken" which means the php isn't correct. Any ideas where I went wrong? Thanks

    Read the article

  • How to learn web-programming (Javascript, PHP)?

    - by metal-gear-solid
    If I'm going to learn programming first time, How i should start? I don't know programming yet but I'm good at XHTML and CSS. my main aim is to learn first Javascript than second PHP. after having good command in Javascript I'll move to PHP. all these i want to learn to get good command in all areas of Wordpress design and Development. Although i can use basic javascript, jquery, PHP scripts in my projects but know i want to learn programming concept and want to get good knowledge.

    Read the article

  • php explode() delimiter issue

    - by mumis2012
    I am new to php so this may be a simple fix. I have a text file named 'textt.txt' that looks like this: South East asia,2222,code1 winter break,3333,code2 my php code looks like this: <?php $x = file_get_contents('textt.txt'); $y = explode("\r\n", $x); $z = $y[0]; echo $z; ?> the outcome of this is: South East asia,2222,code1 I would like it to return only: South East Asia. How can I make this happen? Thanks!

    Read the article

  • Wordpress SQL_CALC fix causes PHP error

    - by ok1ha
    I'm looking for some followup on an older topic for Wordpress where SQL_CALC was found to slow things down when you have a large DB in Wordpress. I have been using the code, at the bottom of this post, to get around it but it does generate an error in my error log. How would I prevent this error? PHP Warning: Division by zero in /var/www/vhosts/domain.com/httpdocs/wp-content/themes/greatTheme/functions.php on line 19 The original thread: http://wordpress.org/support/topic/slow-queries-sql_calc_found_rows-bringing-down-site?replies=25 The code in my functions.php: add_filter('pre_get_posts', 'optimized_get_posts', 100); function optimized_get_posts() { global $wp_query, $wpdb; $wp_query->query_vars['no_found_rows'] = 1; $wp_query->found_posts = $wpdb->get_var( "SELECT COUNT(*) FROM wp_posts WHERE 1=1 AND wp_posts.post_type = 'post' AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'private')" ); $wp_query->found_posts = apply_filters_ref_array( 'found_posts', array( $wp_query->found_posts, &$wp_query ) ); $wp_query->max_num_pages = ceil($wp_query->found_posts / $wp_query->query_vars['posts_per_page']); return $wp_query; }

    Read the article

  • PHP-friendly NoSQL solutions

    - by mattbasta
    I'm looking to use a NoSQL solution for my next project, which will be written in PHP. What choices do I have in terms of NoSQL solutions that can easily interfaced via PHP? I haven't done much thinking about the architecture yet, so I'm not sure what my needs will be; I'd simply like to know what my choices are so I don't build something I can't reasonably implement. For instance, I know Cassandra has Pandra, but that's just a PHP library. MongoDB has a native PECL extension.

    Read the article

  • I have some basic questions setting up a PHP daemon

    - by mike
    I will be writing my first daemon in php and I have a couple really basic questions that I need help with. 1) What packages need to be installed on my linux server and Does anything in PHP need to be enabled? So far I have gotten this - http://pear.php.net/package/System_Daemon/download 2) Where on server do I save my daemon files? 3) I have a number of files that need to be included within the daemon that contain classes and functions for gathering emails and attachments through IMAP. All of these files are currently in my web public directory, how do I include these files within my daemon? I think that is everything I need to get started. Thanks so much!

    Read the article

  • What is "with" used for in PHP?

    - by Jason
    I have come across this line in the eloquent ORM library: return with(new static)->newQuery(); I've never seen "with" used before, and cannot find it in the PHP documentation. I'm guessing "with" is a stop-word in most searches, so I am not even getting close. Never having encountered "with" in many years of programming PHP, I feel like I'm missing out. What does it do? I did come across one passing comment regarding the ORM, that mentioned "with" is no longer needed in PHP-5.4, but that was as much as was said.

    Read the article

  • Php security question

    - by Camran
    I have a linux server, and I am about to upload a classifieds website to it. The website is php based. That means php code adds/removes classifieds, with the help of the users offcourse. The php-code then adds/removes a classified to a database index called Solr (like MySql). Problem is that anybody can currently access the database, but I only want the website to access the database (solr). Solr is on port 8983 as standard btw. My Q is, if I add a rule in my firewall (iptables), to only allow connections coming from the servers IP to the Solr port nr, would this solve my issue? Thanks

    Read the article

  • post selextbox values to php page in jquery

    - by JPro
    I am using jquery button click to post all the values in a selectbox to a PHP page, but this code does not seem to work. Can anyone please help? <script type="text/javascript"> $(function() { $("#btn1").click(function () { var arr= new Array; $("#target_select option").each (function () { // You can push the array on an array arr.push( $(this).val() ); //alert( $(this).val() ); not getting the alert to display too }); $.post("test.php", { name: arr } ); }); }); </script> Generate

    Read the article

  • how can i send jquery ajax http request with php

    - by testkhan
    i have following form... <form action="http://mydomain.com/get.php" method="post"> <input type="hidden" value="thisisvalue" name="hdnvalue"> <input type="text" name="cost" id="cost"><br><br> <textarea id="msg" name="message"></textarea><br><br> <input type="submit" value="Send" id="send"> </form> the get.php file will response in 1 or 0 i.e 1 means recieved and 0 means not recieved now i want to send it to http://mydomain.com/get.php via http request with jquery ajax how can i do that get the returned value..

    Read the article

< Previous Page | 167 168 169 170 171 172 173 174 175 176 177 178  | Next Page >