Php-httpsqs-client application

Source: Internet
Author: User
Installation Instructions for php-httpsqs-client mkdirphp_httpsqs_client? Cdphp_httpsqs_client? Unzipphp_httpsqs_0.1.zip? Usrlocalphpbinphpize ?. Configure -- enable-httpsqs -- with-php-co php-httpsqs-client usage

Installation Instructions

Mkdir php_httpsqs_client? Cd php_httpsqs_client?
Unzip php_httpsqs_0.1.zip? /Usr/local/php/bin/phpize? ./Configure -- enable-httpsqs
-- With-php-config =/usr/local/php/bin/php-config? Make & make install?
# Add a line in php. ini? Extension = httpsqs. so;
Function description
/**? ? * Create an httpsqs connection? ? * @ Param string $ host server address. it can be blank. the default value is 127.0.0.1? ? * @ Param int? ? $ Port: The server port. it can be null. the default value is 1218? ? * @ Return resource? ? */? $ Hr = httpsqs_connect ("fig", 1218 );
/**? ? * Write queue data? ? * @ Param resource $ hr? ? ? Server connection handle? ? * @ Param string? $ Queue? Queue name? ? * @ Param string? $ Data? ? Write data? ? * @ Param string? $ Charset character set. it can be null. the default value is UTF-8? ? * @ Return boolean? ? */?
$ PutRes = httpsqs_put ($ hr, "testQueue", "This is a test Data", "UTF-8 ");
/**? ? * Get the last row of data in the queue? ? * @ Param resource $ hr? ? * @ Param string? $ Queue? ? * @ Param boolean? $ Return_array: whether to return an array. it can be null. the default value is false? ? ? ? ? ? Returned array format: array ('pos' => 'queue insertion point', 'data' => 'data value ')? ? * @ Param string? $ Charset can be blank? ? * @ Return mixed? ? */? $ Content = httpsqs_get ($ hr, "testQueue", true, "UTF-8 ");
/**? ? * Get the queue status? ? * @ Param resource $ hr? ? * @ Param string? $ Queue? ? * @ Param boolean? $ Return_json: whether the returned status is in json format. it can be blank. the default value is false? ? * @ Return string? ? */? $ Status = httpsqs_status ($ hr, "testQueue", true );
/**? ? * Get data at a certain point in the queue? ? * @ Param resource $ hr? ? * @ Param string? $ Queue? ? * @ Param int? ? ? $ Position of the data to be obtained by pos? ? * @ Param string? $ Charset can be blank? ? * @ Return string? ? */? $ PosData = httpsqs_view ($ hr, "testQueue", 10, "UTF-8 ");
/**? ? * Queue reset? ? * @ Param resource $ hr? ? * @ Param string? $ Queue? ? * @ Return boolean? ? */? $ ResetRes = httpsqs_reset ($ hr, "testQueue ");
/**? ? * Set the maximum number of data records in the queue? ? * @ Param resource $ hr? ? * @ Param string? $ Queue? ? * @ Param int? ? ? $ What is the maximum number of data entries in a maxqueue queue? ? * @ Return boolean? ? */? $ MaxqueueRes = httpsqs_maxqueue ($ hr, "testQueue", 10000 );
/**? ? * How long does it take to regularly refresh the memory buffer content to the disk? ? * @ Param resource $ hr? ? * @ Param string? $ Queue? ? * @ Param int? ? ? $ Synctime interval? ? * @ Return boolean? ? */? $ SynctimeRes = httpsqs_synctime ($ hr, "testQueue", 10 );
Object call
// The parameter corresponds to httpsqs_connect? $ Hr = new HttpSQS ($ host, $ port );? ? // The parameter corresponds to httpsqs_get? $ Hr-> get ($ queuename, $ return_array, $ charset );? ? // The parameter corresponds to httpsqs_put? $ Hr-> put ($ queuename, $ data, $ charset );? ? // The parameter corresponds to httpsqs_status? $ Hr-> status ($ queuename, $ return_json );? ? // The parameter corresponds to httpsqs_view? $ Hr-> view ($ queuename, $ pos );? ? // The parameter corresponds to httpsqs_reset? $ Hr-> reset ($ queuename );? ? // The parameter corresponds to httpsqs_maxqueue? $ Hr-> maxqueue ($ queuename );? ? // The parameter corresponds to httpsqs_synctime? $ Hr-> synctime ($ queuename );
Example
// Fetch data Daemon? $ Hr = httpsqs_connect ($ host, $ port );? While (1 ){? ? ?
$ Data = httpsqs_get ($ hr, $ queuename, $ charset );? ? ?
If ($ data = false ){? ? ? ? ? Sleep (1 );? ? ? } Else {? ? ? ? // Do something ...? ? ? }? }? ?
? // Or? $ Hr = new HttpSQS ($ host, $ port );? While (1 ){? ? ? $ Data = $ hr-> get ($ queuename, $ charset );? ? ?
? If ($ data = false ){? ? ? ? ? Sleep (1 );? ? ? } Else {? ? ? ? // Do something ...? ? ? }? }? ?
? // Write data? $ Hr = httpsqs_connect ($ hort, $ port );? Httpsqs_put ($ hr, $ queuename, $ data, $ charset );? ?
? // Or? $ Hr = new HttpSQS ($ hort, $ port );? $ Hr-> put ($ queuename, $ data, $ charset );

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.