Search Results

Search found 31819 results on 1273 pages for 'sphinx php'.

Page 91/1273 | < Previous Page | 87 88 89 90 91 92 93 94 95 96 97 98  | Next Page >

  • php variable scope in oop

    - by mr o
    Hi, I wonder if anyone can help out here, I'm trying to understand how use an objects properties across multiple non class pages,but I can't seem to be able to get my head around everything i have tried so far. For example a class called person; class person { static $name; } but i have a number of different regular pages that want to utilize $name across the board. I have trying things like this; pageone.php include "person.php"; $names = new Person(); echo person::$name; names::$name='bob'; pagetwo.php include "person.php"; echo person::$name; I can work with classes to the extent I'm OK as long as I am creating new instances every page, but how can make the properties of one object available to all, like a shared variable ? Thanks

    Read the article

  • PHP invalid image's and error handling

    - by Emdiesse
    Using PHP's Image and GD functions you can use the following method to finally output the php image imagepng($image); Sometimes, for whatever reason the image may not be displayed typically the error is not with the image but with the actual php functions not executing successfully. However this causes a blank image to be returned which doesn't help me. What I want to know is, is there a way to detect a blank or an invalid image and create a new image, write the errors to the new image using imagestring() and then display this new (debug) image instead. for example, a successfully displayed image with no errors: $image = imagecreate(256, 256); //create image imagecolortransparent($image, $BLUE); //set transparent imagefilledrectangle($image, 0, 0, 256, 256, $BLUE); //fill with 'transparent colour' //Draw a border round the image imageline($image, 0, 0, 0, 255, $Black); imageline($image, 0, 0, 255, 0, $Black); imageline($image, 255, 0, 255, 255, $Black); imageline($image, 0, 255, 255, 255, $Black); imagestring($image, 1, 10, 10, "I am an image!", $Black); imagepng($image); imagedestroy($image); but if I then introduce some errors in the php script that may or may not be to do with the actual image creation then the php script fails and the image will not be visible... $image = imagecreate(256, 256); //create image imagecolortransparent($image, $BLUE); //set transparent imagefilledrectangle($image, 0, 0, 256, 256, $BLUE); //fill with 'transparent colour' //Draw a border round the image imageline($image, 0, 0, 0, 255, $Black); imageline($image, 0, 0, 255, 0, $Black); imageline($image, 255, 0, 255, 255, $Black); imageline($image, 0, 255, 255, 255, $Black); imagestring($image, 1, 10, 10, "I am an image!", $Black); /* I am here to cause problems with the php script ** and cause the execution to fail, I am a function ** that does't exist... ** ** and I am missing a semi colon! ;)*/ non_existant_function() imagepng($image); imagedestroy($image); At this point I want to create a new image like above but in replacement of the I am an image! text I would put the actual error that has occured.

    Read the article

  • Calling Msbuild from Php - Wrong Codepage and Culture

    - by miasbeck
    I have a Php script that calls Msbuild via System: <?php system( "msbuild umlaut.proj" ); ?> This is the project file: <?xml version="1.0" encoding="UTF-8"?> <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="EchoUmlaut" ToolsVersion="3.5"> <Target Name="EchoUmlaut"> <Message Text="Umlaute: Ä Ö Ü ä ö ü ß" /> </Target> </Project> When I call Msbuild directly from the command line the output of msbuild is in German (as excpected) and the umlauts come out OK (I chcp to 1252). But when I use php to call msbuild the umlauts are wrong, and the output of msbuild is changed to English. I wonder what I can do to prevent this. C:\>chcp Aktive Codepage: 1252. C:\>msbuild umlaut.proj Microsoft (R)-Buildmodul, Version 3.5.30729.1 [Microsoft .NET Framework, Version 2.0.50727.3607] Copyright (C) Microsoft Corporation 2007. Alle Rechte vorbehalten. Das Erstellen wurde am 13.04.2010 08:57:04 gestartet. Projekt "D:\Cvsroot\projekte\e4elaui\v1.0\umlaut.proj" auf Knoten 0 (Standardziele). Umlaute: Ä Ö Ü ä ö ü ß Die Erstellung von Projekt "D:\Cvsroot\projekte\e4elaui\v1.0\umlaut.proj" ist abgeschlossen (Standardziele). Das Erstellen war erfolgreich. 0 Warnung(en) 0 Fehler Vergangene Zeit 00:00:00 C:\>php call_from_php.php Microsoft (R) Build Engine Version 3.5.30729.1 [Microsoft .NET Framework, Version 2.0.50727.3607] Copyright (C) Microsoft Corporation 2007. All rights reserved. Build started 13.04.2010 08:57:11. Project "D:\Cvsroot\projekte\e4elaui\v1.0\umlaut.proj" on node 0 (default targets). Umlaute: Ž ™ š „ ” á Done Building Project "D:\Cvsroot\projekte\e4elaui\v1.0\umlaut.proj" (default targets). Build succeeded. 0 Warning(s) 0 Error(s) Time Elapsed 00:00:00

    Read the article

  • How often are design patterns used in the workplace using PHP

    - by Metropolis
    Hey everyone, I read a book awhile back called PHP Design Patterns and Practice, and ever since then I have been using design patterns whenever I think they are needed. However it just occurred to me that maybe most companies do not use design patterns very often for PHP, or at all. What I was wondering is, do most companies use design patterns to help improve code flexibility? And if so, what are the best design patterns to learn for PHP? Thanks for any help on this, Metropolis

    Read the article

  • how to install posix in php

    - by Nizzy
    posix does not appear when I run php -m cmd, however, I see it from the phpinfo() –enable-posix=shared on Linux with Plesk 9. Basically, I can't use posix_*() functions as described at http://www.php.net/manual/en/ref.posix.php this shows doesn't exists: if (function_exists(‘posix_getuid’)) { echo “posix_getuid available”; } else { echo “posix_getuid not available”; // this prints in my server. } could someone show me how to install it? thank you [PHP Modules] bz2 calendar ctype curl date dbase dom exif fileinfo filter ftp gd geoip gettext gmp hash iconv imap ionCube Loader json libxml mbstring mcrypt memcache mhash mysql mysqli openssl pcntl pcre PDO pdo_mysql pdo_sqlite readline Reflection session shmop SimpleXML sockets SPL sqlite standard tokenizer wddx xml xmlreader xmlwriter xsl zip zlib

    Read the article

  • Text mining with PHP

    - by garyc40
    Hi, I'm doing a project for a college class I'm taking. I'm using PHP to build a simple web app that classify tweets as "positive" (or happy) and "negative" (or sad) based on a set of dictionaries. The algorithm I'm thinking of right now is Naive Bayes classifier or decision tree. However, I can't find any PHP library that helps me do some serious language processing. Python has NLTK (http://www.nltk.org). Is there anything like that for PHP? I'm planning to use WEKA as the back end of the web app (by calling Weka in command line from within PHP), but it doesn't seem that efficient. Do you have any idea what I should use for this project? Or should I just switch to Python? Thanks

    Read the article

  • PHP - can a method return a pointer?

    - by Kerry
    I have a method in a class trying to return a pointer: <?php public function prepare( $query ) { // bla bla bla return &$this->statement; } ?> But it produces the following error: Parse error: syntax error, unexpected '&' in /home/realst34/public_html/s98_fw/classes/sql.php on line 246 This code, however, works: <?php public function prepare( $query ) { // bla bla bla $statement = &$this->statement; return $statement; } ?> Is this just the nature of PHP or am I doing something wrong?

    Read the article

  • Twitter Oauth home timeline display with php

    - by Srinivas Tamada
    $hometime= $Twitter-get_statusesHome_timeline(); Fatal error: Uncaught exception 'Exception' with message 'SimpleXMLElement::__construct() expects parameter 1 to be string <?php include 'EpiCurl.php'; include 'EpiOAuth.php'; include 'EpiTwitter.php'; include 'key.php'; $Twitter = new EpiTwitter($consumerKey, $consumerSecret); $oauthToken='xxxxxxxxxxxxxxxxxxxxxxx'; $oauthSecret='xxxxxxxxxxxxxxxxxxxxxxxxx'; // user switched pages and came back or got here directly, stilled logged in $Twitter->setToken($oauthToken,$oauthSecret); $user= $Twitter->get_accountVerify_credentials(); echo "<img src=\"{$user->profile_image_url}\">"; echo "{$user->name}"; $hometime= $Twitter->get_statusesHome_timeline(); $twitter_status = new SimpleXMLElement($hometime); foreach($twitter_status->status as $status){ echo '<div class="twitter_status">'; foreach($status->user as $user){ echo '<img src="'.$user->profile_image_url.'" class="twitter_image">'; echo '<a href="http://www.twitter.com/'.$user->name.'">'.$user->name.'</a>: '; } echo $status->text; echo '<br/>'; echo '<div class="twitter_posted_at"><strong>Posted at:</strong> '.$status->created_at.'</div>'; echo '</div>'; } ?>

    Read the article

  • Intercept page request behind firewall return altered content with php and apache

    - by Matthew
    I'm providing free wifi service and need an ad to be added to all page requests. Currently I have a router forwarding all http requests to an apache server, which redirects all requests to an index.php page. The index.php page reads the request, fetches the content from the appropriate site, and edits the content to include the ad. The problem is that all images and css files etc. cannot be accessed, because when the browser tries to get the image <img src="site.com/image.jpg"> it's just redirected back to the index.php. I can change settings for the router (running dd-wrt) and the webserver (apache2 and php 5.2). Is there a solution that allows content to be edited before returning to the client, and allows css and images to be accessed?

    Read the article

  • Inversion of Control Container for PHP?

    - by George Mauer
    I am trying to code TDD style in PHP and one of my biggest stumbling blocks (other than lack of a decent IDE) is that I have to make my own hacked together IoC container just to inject all my mock objects properly. Has anyone used an Ioc container in php? All I've been able to find is PHP IOC on the ever-annoying phpclasses.org and it seems to have almost no documentation and not much of a following.

    Read the article

  • Convert old NuSoap code into PHP core soap functions

    - by Enrique
    Hi I've been testing nuSoap with codeIgniter (PHP Framework) but seems nuSoap isn't prepared to work with latest php 5.3, even if I download a patched nusoap version for php 5.3 I have the following code: require_once(APPPATH.'libraries/NuSOAP/lib/nusoap'.EXT); //includes nusoap $n_params = array('CityName' => 'San Juan', 'CountryName' => 'Argentina'); $client = new nusoap_client('http://www.webservicex.net/globalweather.asmx?WSDL'); $client->setHTTPProxy("10.2.0.1",6588,"",""); $result = $client->call('GetWeather', $n_params); Can any1 help me to convert these functions into php soap functions? Including proxy function? Thanks a lot

    Read the article

  • Salesforce/PHP - outbound messages (SOAP) - memory limit issue

    - by Phill Pafford
    I'm using Salesforce to send outbound messages (via SOAP) to another server. The server can process about 8 messages at a time, but will not send back the ACK file if the SOAP request contains more than 8 messages. SF can send up to 100 outbound messages in 1 SOAP request and I think this is causing a memory issue with PHP. If I process the outbound messages 1 by 1 they all go through fine, I can even do 8 at a time with no issues. But larger sets are not working. ERROR in SF: org.xml.sax.SAXParseException: Premature end of file Looking in the HTTP error logs I see that the incoming SOAP message looks to be getting cut of which throws a PHP warning stating: Premature end of data in tag ... PHP Fatal error: Call to a member function getAttribute() on a non-object This leads me to believe that PHP is having a memory issue and can not parse the incoming message due to it's size. I was thinking I could just set: ini_set('memory_limit', '64M'); But would this be the correct approach? Is there a way I could set this to increase with the incoming SOAP request dynamically? UPDATE: Adding some code $data = fopen('php://input','rb'); $headers = getallheaders(); $content_length = $headers['Content-Length']; $buffer_length = 1000; $fread_length = $content_length + $buffer_length; $content = fread($data,$fread_length); /** * Parse values from soap string into DOM XML */ $dom = new DOMDocument(); $dom->loadXML($content); ....

    Read the article

  • PHP Browser Detection and Redirection

    - by Vincent
    All, My application supports IE7+, MOZILLA and other modern browsers. Anybody know of a very good browser detection and redirection PHP class? I came across this, but I am not sure if anybody used this: http://chrisschuld.com/projects/browser-php-detecting-a-users-browser-from-php/#typicalusage Thanks

    Read the article

  • PHP - Plus sign with GET query

    - by Nate Shoffner
    I have a PHP script that does basic encryption of a string through the method below: <?php $key = 'secretkey'; $string = $_GET['str']; if ($_GET['method'] == "decrypt") { $output = rtrim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256, md5($key), base64_decode($string), MCRYPT_MODE_CBC, md5(md5($key))), "\0"); } if ($_GET['method'] == "encrypt") { $output= base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, md5($key), $string, MCRYPT_MODE_CBC, md5(md5($key)))); } echo $output; ?> An example of a URL to encrypt a string would look like this: Encrypt.php?method=encrypt&str=the quick fox Which would return this as the encrypted string: LCuT/ieVa6cl3/4VtzE+jd9QPT3kvHYYJFqG6tY3P0Q= Now to decrypt the string all you have to do is change the "method" query to "decrypt", like so: Encrypt.php?method=decrypt&str=LCuT/ieVa6cl3/4VtzE+jd9QPT3kvHYYJFqG6tY3P0Q= The only problem is that when that encrypted string is decrypted it returns this: ¬ƒ§rYV}̳5Äš·nßì(ñïX8Þ;b I have narrowed down the problem to the plus sign that is in the encrypted string. PHP's GET method seems to translate a plus sign into a blank space. I have searched this bug and found out that it has already been filed here. I have tried different methods listed on that page and others with no success. The closest I got is by using this: $fixedstring = str_replace(" ", "+", $string); and then using $fixedstring in the encryption methods, the problem is, upon decryption, all blank spaces are converted to plus signs. Any ideas?

    Read the article

  • Best method for Flex to PHP communication?

    - by davr
    What is the best method for communication between Flex and PHP? In the past, we used AMFPHP with AS2, and it worked great for the most part (advantage of AMFPHP is that it also has a JSON mode that can let you seamlessly use the same remote PHP with either Javascript or Actionscript frontends). However, it seems like AMFPHP isn't realy maintained anymore. So what do people recommend to replace it? So far, what I've found is: Zend_AMF (looks too complex for us, we're not using the Zend framework otherwise) AMFPHP (there were some updated made to support Flex, and it seems fairly stable, but not sure on long-term support) XML (AS3 has nice XML handling routines, but it's more of a pain on the PHP side) WebORB (I have no experience with this) Roll-our-own using JSON or some other data-to-text serialization system (php's serialize(), XML, etc etc) Mostly I'm leaning towards AMFPHP, even because of the downsides, since that's what I'm used to. Any reason I should consider switching to something else?

    Read the article

  • Which PHP version is required for str_split?

    - by SpawnCxy
    I relogin to my server in dreamhost and test some scripts.And I found I couldn't use str_split. Message of Undefined function was given.I checked the version in the server and its PHP Version is 5.2.12.And I just wonder which version is required?Thanks. Testcode: <?php $arr = str_split("lsdjflsdjflsdjflsdjfl"); print_r($arr); ?> Message: Fatal error: Call to undefined function: str_split() in /test.php on line 3

    Read the article

  • PHP: Convert <ul> <li> Tree HTML tag to an array

    - by marknt15
    Hi, I'm using jsTree and I need to convert this HTML tag tree code <ul> <li> to a PHP array. The jsTree HTML tag will be passed to PHP to be parsed and store in a structured tree PHP array(see below for the PHP array structure). Additional question: Is my desired PHP array structure good or you can suggest a good structure? I'm open for suggestions. Thanks in advance :) Cheers, Mark jsTree Screenshot: HTML Tree String: <ul class="ltr"> <li id="phtml_1" class=" open"> <a style="" class=" " href="#"><ins>&nbsp;</ins>Folder 1</a> <ul> <li class="leaf" id="phtml_2"> <a style="" class=" " href="#"><ins>&nbsp;</ins>Child 1.1</a> </li> <li class="open" id="phtml_3"> <a style="" class=" " href="#"><ins>&nbsp;</ins>Folder 1.1</a> <ul> <li class="leaf last" rel="default"> <a href="" style="" class=" "><ins>&nbsp;</ins>Child 1.1.1</a> </li> </ul> </li> <li class="last open" rel="default"> <a href="" style="" class=" "><ins>&nbsp;</ins>Folder 1.2</a> <ul> <li class="leaf" rel="default"> <a href="" style="" class=" "><ins>&nbsp;</ins>Child 1.2.1</a> </li> <li class="leaf last" rel="default"> <a href="" style="" class=" "><ins>&nbsp;</ins>Child 1.2.2</a> </li> </ul> </li> </ul> </li> <li id="phtml_5" class="file open"> <a style="" class=" " href="#"><ins>&nbsp;</ins>Folder 2</a> <ul> <li class="leaf" rel="default"> <a href="" style="" class=" "><ins>&nbsp;</ins>Child 2.1</a> </li> <li class="leaf last" rel="default"> <a href="" style="" class="clicked"><ins>&nbsp;</ins>Child 2.2</a> </li> </ul> </li> <li class="leaf last" rel="default"> <a href="" style="" class=" "><ins>&nbsp;</ins>Outer Child</a> </li> </ul> PHP Array Structure: <?php $tree_array = array( 'Folder 1' => array( 'Child 1.1', 'Folder 1.1' => array( 'Child 1.1.1' ), 'Folder 1.2' => array( 'Child 1.2.1', 'Child 1.2.2' ), ), 'Folder 2' => array( 'Child 2.1', 'Child 2.2' ), 'Outer Child' ); echo '<pre>',print_r($tree_array),'</pre>'; ?> PHP print_r Output: Array ( [Folder 1] => Array ( [0] => Child 1.1 [Folder 1.1] => Array ( [0] => Child 1.1.1 ) [Folder 1.2] => Array ( [0] => Child 1.2.1 [1] => Child 1.2.2 ) ) [Folder 2] => Array ( [0] => Child 2.1 [1] => Child 2.2 ) [0] => Outer Child )

    Read the article

  • How can I install and launch tesseract-ocr using PHP

    - by paulrajj
    I am looking for a OCR component that converts images of text into characters using php. I got a script tesseract-ocr from google code. How can I install and launch tesseract-ocr through php ? As I am a beginner in PHP, I cant come up with the documentation they provided. I need some simple steps to install and launch ? thanks in advance.

    Read the article

  • Connecting to a WCF Service in PHP that has a a NetTCP Binding and a BasicHttpBinding

    - by Justin Dearing
    I have a WCF service. It has multiple clients and three endpoints. The endpoint bindings are nettcp, wsHttp and basicHttp. If I attempt to connect to it via php'd builtin SoapClient class like so: $service = new SoapClient ("http://service.companyname.local:6666/Service/?wsdl", array( "location" => "http://service.companyname.local:6666/Service/Basic", "trace" => true, 'soap_version' => SOAP_1_1 ) ); I get the following: PHP Fatal error: SOAP-ERROR: Parsing WSDL: PHP-SOAP doesn't support transport 'http://schemas.microsoft.com/soap/tcp' in c:\www\client.php on line 666 Right now my workaround is to save the wsdl manually and remove the nettcp binding. Is there a workaround that will allow me to use the automatically generated wsdl? Can I hide a binding from the wsdl in web.config? Can I generate different wsdls on different bindings. I don't want to deploy two service hosts.

    Read the article

  • Apache/PHP - alias outgoing URL

    - by Dan
    In my PHP code I've got references to a URL on another website. I'm testing my website locally (using XAMPP). Is it possible to get Apache to automatically replace the domain of this other website for localhost? For example my PHP code might be: <?php echo "<a href='http://www.othersite.com'>Click me</a>"; ?> And I'd like for my local Apache to alias this to <?php echo "<a href='http://localhost'>Click me</a>"; ?> Is this possible? Cheers, Dan.

    Read the article

< Previous Page | 87 88 89 90 91 92 93 94 95 96 97 98  | Next Page >