本文整理汇总了PHP中Zend_Dom_Query类的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Dom_Query类的具体用法?PHP Zend_Dom_Query怎么用?PHP Zend_Dom_Query使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Zend_Dom_Query类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: getContent
/**
* returns the content of this item
*
* @return string content
*/
public function getContent()
{
if ($this->items !== false && $this->valid()) {
try {
// load entry page
$client = new Zend_Http_Client($this->getLink() . '?page=all');
$response = $client->request();
$content = $response->getBody();
$content = utf8_decode($content);
// parse content
$dom = new Zend_Dom_Query($content);
$text = $dom->query('.article');
$innerHTML = '';
// convert innerHTML from DOM to string
// taken from http://us2.php.net/domelement (patrick smith)
$children = $text->current()->childNodes;
foreach ($children as $child) {
$tmp_doc = new DOMDocument();
$tmp_doc->appendChild($tmp_doc->importNode($child, true));
if (count($tmp_doc->getElementById('comments')) > 0) {
continue;
}
// convert to text
$innerHTML .= @$tmp_doc->saveHTML();
}
return $innerHTML;
} catch (Exception $e) {
// return default content
return current($this->items)->get_content();
}
}
}
开发者ID:google-code-backups,项目名称:rsslounge,代码行数:37,代码来源:zeit.php
示例2: _changeExternalLinks
protected static function _changeExternalLinks(&$content)
{
if (empty($content)) {
return;
}
$dom = new Zend_Dom_Query();
$dom->setDocumentHtml($content, 'utf-8');
if ($dom->getDocumentErrors()) {
return;
}
$query = $dom->query('.externalLink');
if (!$query->count()) {
return;
}
$links = array();
/** @var DOMElement $a */
foreach ($query as $a) {
$link = $a->getAttribute('href');
if (empty($link)) {
continue;
}
$links[] = $link;
GFNLinkProxy_Api::preload($link);
}
foreach ($links as $link) {
$content = preg_replace_callback('#(<a[^>]+href=("|\')?)(' . preg_quote($link, '#') . ')(("|\')?[^>]+class=("|\')?[^"\']*externalLink[^"\']*("|\')?[^>]*>)#sU', array(__CLASS__, '_replace'), $content, 1);
}
}
开发者ID:Sywooch,项目名称:forums,代码行数:28,代码来源:FrontController.php
示例3: _findId
/**
* @desc find id
* @author makinder
* @param string|array $url;
* @version 0.0.1
*/
protected function _findId($urls)
{
if (!is_array($urls)) {
throw new Exception('url must be an array' . $urls);
}
foreach ($urls as $what => $url) {
$total_info = file_get_contents($url);
$dom = new Zend_Dom_Query($total_info);
$links = $dom->query('a');
$data = array();
foreach ($links as $item) {
$data[] = $item->getAttribute('href');
}
$find = '/title/tt';
$result = array();
foreach ($data as $index => $value) {
if (strpos($value, $find) !== false) {
$item = substr($value, strpos($value, '/tt') + 1, 9);
$result[] = $item;
}
}
$request = array();
$hoho[$what] = array_unique($result);
}
return $hoho;
}
开发者ID:nurikk,项目名称:EvilRocketFramework,代码行数:32,代码来源:VideoImdb.php
示例4: getNewSizingChartContent
/**
* Get Sizing Chart content from remote resource
*/
public function getNewSizingChartContent($ptn)
{
if ($ptn) {
$uri = Mage::getStoreConfig('yk_config/asc/url') . $ptn;
$client = new Zend_Http_Client();
$client->setUri($uri);
$response = $client->request();
if ($html = $response->getBody()) {
$dom = new Zend_Dom_Query();
$dom->setDocumentHtml($html);
$results = $dom->query(Mage::getStoreConfig('yk_config/asc/container'));
if (count($results)) {
foreach ($results as $result) {
$innerHTML = '';
$children = $result->childNodes;
foreach ($children as $child) {
$innerHTML .= $child->ownerDocument->saveHTML($child);
}
return $innerHTML;
}
}
}
}
return false;
}
开发者ID:Vedariy,项目名称:test,代码行数:28,代码来源:Chart.php
示例5: logIn
private function logIn()
{
$valuesLogin = array(new Oara_Curl_Parameter('username', $this->_credentials['user']), new Oara_Curl_Parameter('password', $this->_credentials['password']));
$cookies = COOKIES_BASE_DIR . DIRECTORY_SEPARATOR . $this->_credentials['cookiesDir'] . DIRECTORY_SEPARATOR . $this->_credentials['cookiesSubDir'] . DIRECTORY_SEPARATOR . $this->_credentials["cookieName"] . '_cookies.txt';
unlink($cookies);
$this->_options = array(CURLOPT_USERAGENT => "Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:26.0) Gecko/20100101 Firefox/26.0", CURLOPT_RETURNTRANSFER => true, CURLOPT_FAILONERROR => true, CURLOPT_COOKIEJAR => $cookies, CURLOPT_COOKIEFILE => $cookies, CURLOPT_HTTPAUTH => CURLAUTH_ANY, CURLOPT_AUTOREFERER => true, CURLOPT_SSL_VERIFYPEER => false, CURLOPT_SSL_VERIFYHOST => false, CURLOPT_HEADER => false, CURLOPT_FOLLOWLOCATION => false, CURLOPT_HTTPHEADER => array('Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'Accept-Language: es,en-us;q=0.7,en;q=0.3', 'Accept-Encoding: gzip, deflate', 'Connection: keep-alive', 'Cache-Control: max-age=0'), CURLOPT_ENCODING => "gzip", CURLOPT_VERBOSE => false);
$rch = curl_init();
$options = $this->_options;
curl_setopt($rch, CURLOPT_URL, "https://billing.purevpn.com/clientarea.php");
curl_setopt_array($rch, $options);
$html = curl_exec($rch);
curl_close($rch);
sleep(10);
$rch = curl_init();
$options = $this->_options;
curl_setopt($rch, CURLOPT_URL, "https://billing.purevpn.com/clientarea.php");
curl_setopt_array($rch, $options);
$html = curl_exec($rch);
curl_close($rch);
$dom = new Zend_Dom_Query($html);
$hidden = $dom->query('#frmlogin input[name="token"][type="hidden"]');
foreach ($hidden as $values) {
$valuesLogin[] = new Oara_Curl_Parameter($values->getAttribute("name"), $values->getAttribute("value"));
}
$rch = curl_init();
$options = $this->_options;
curl_setopt($rch, CURLOPT_URL, "https://billing.purevpn.com/dologin.php?goto=clientarea.php");
$options[CURLOPT_HTTPHEADER] = array('Referer: https://billing.purevpn.com/clientarea.php', 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'Accept-Language: es,en-us;q=0.7,en;q=0.3', 'Accept-Encoding: gzip, deflate', 'Connection: keep-alive', 'Cache-Control: max-age=0');
$options[CURLOPT_POST] = true;
$arg = array();
foreach ($valuesLogin as $parameter) {
$arg[] = $parameter->getKey() . '=' . urlencode($parameter->getValue());
}
$options[CURLOPT_POSTFIELDS] = implode('&', $arg);
curl_setopt_array($rch, $options);
$html = curl_exec($rch);
curl_close($rch);
$rch = curl_init();
$options = $this->_options;
$options[CURLOPT_URL] = "https://billing.purevpn.com/check_affiliate.php?check=affiliate";
$options[CURLOPT_HEADER] = true;
$options[CURLOPT_NOBODY] = false;
$options[CURLOPT_HTTPHEADER] = array('Referer: https://billing.purevpn.com/affiliates.php', 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'Accept-Language: es,en-us;q=0.7,en;q=0.3', 'Accept-Encoding: gzip, deflate', 'Connection: keep-alive', 'Cache-Control: max-age=0');
curl_setopt_array($rch, $options);
$header = curl_exec($rch);
preg_match('/Location:(.*?)\\n/', $header, $matches);
$newurl = trim(array_pop($matches));
curl_close($rch);
if (preg_match("/S=(.*)/", $newurl, $matches)) {
$this->_s = $matches[1];
}
$rch = curl_init();
$options = $this->_options;
$options[CURLOPT_URL] = $newurl;
$options[CURLOPT_HTTPHEADER] = array('Referer: https://billing.purevpn.com/affiliates.php', 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'Accept-Language: es,en-us;q=0.7,en;q=0.3', 'Accept-Encoding: gzip, deflate', 'Connection: keep-alive', 'Cache-Control: max-age=0');
curl_setopt_array($rch, $options);
$content = curl_exec($rch);
}
开发者ID:netzkind,项目名称:php-oara,代码行数:58,代码来源:PureVPN.php
示例6: task
public function task(Zend_Http_Response $response, Zend_Http_Client $client)
{
$query = new Zend_Dom_Query($response->getBody());
$images = $query->query('img');
foreach ($images as $image) {
$this->images[] = $image->getAttribute('src');
}
$this->images = array_unique($this->images);
}
开发者ID:austinphp,项目名称:crawler,代码行数:9,代码来源:FindImagesTask.php
示例7: getThumbnail
/**
* returns the thumbnail of this item (for multimedia feeds)
*
* @return mixed thumbnail data
*/
public function getThumbnail()
{
$item = current($this->items);
// allways take photo from content
$dom = new Zend_Dom_Query(@$item->get_content());
$imgTags = $dom->query('img');
if (count($imgTags)) {
return $imgTags->current()->getAttribute('src');
}
}
开发者ID:google-code-backups,项目名称:rsslounge,代码行数:15,代码来源:flickr.php
示例8: run
public function run()
{
if ($this->debugMode) {
echo "Restricting crawl to {$this->domain}\n";
}
//loop across available items in the queue of pages to crawl
while (!$this->queue->isEmpty()) {
if (isset($this->limit) && $this->counter >= $this->limit) {
break;
}
$this->counter++;
//get a new url to crawl
$url = $this->queue->pop();
if ($this->debugMode) {
echo "Queue Length: " . $this->queue->queueLength() . "\n";
echo "Crawling " . $url . "\n";
}
//set the url into the http client
$this->client->setUri($url);
//make the request to the remote server
$this->currentResponse = $this->client->request();
//don't bother trying to parse this if it's not text
if (stripos($this->currentResponse->getHeader('Content-type'), 'text') === false) {
continue;
}
//search for <a> tags in the document
$body = $this->currentResponse->getBody();
$linksQuery = new Zend_Dom_Query($body);
$links = $linksQuery->query('a');
if ($this->debugMode) {
echo "\tFound " . count($links) . " links...\n";
}
foreach ($links as $link) {
//get the href of the link and find out if it links to the current host
$href = $link->getAttribute('href');
$urlparts = parse_url($href);
if ($this->stayOnDomain && isset($urlparts["host"]) && $urlparts["host"] != $this->domain) {
continue;
}
//if it's an absolute link without a domain or a scheme, attempt to fix it
if (!isset($urlparts["host"])) {
$href = 'http://' . $this->domain . $href;
//this is a really naive way of doing this!
}
//push this link into the queue to be crawled
$this->queue->push($href);
}
//for each page that we see, run every registered task across it
foreach ($this->tasks as $task) {
$task->task($this->currentResponse, $this->client);
}
}
//after we're done with everything, call the shutdown hook on all the tasks
$this->shutdownTasks();
}
开发者ID:austinphp,项目名称:crawler,代码行数:55,代码来源:Crawler.php
示例9: testQueueJsString
public function testQueueJsString()
{
$script = 'Inline JS script.';
queue_js_string($script);
$matcher = array('tag' => 'script', 'attributes' => array('type' => 'text/javascript'));
$output = $this->_getJsOutput(false);
$dom = new Zend_Dom_Query('<fake>' . $output . '</fake>');
$result = $dom->queryXpath("//script[@type='text/javascript']");
$this->assertCount(1, $result, "Script tag for inline script not found.");
$this->assertContains($script, $output);
}
开发者ID:emhoracek,项目名称:Omeka,代码行数:11,代码来源:DisplayJsTest.php
示例10: testQueueCssString
public function testQueueCssString()
{
$style = 'Inline stylesheet.';
queue_css_string($style, 'screen');
$matcher = array('tag' => 'style', 'attributes' => array('type' => 'text/css', 'media' => 'screen'));
$output = $this->_getCssOutput();
$dom = new Zend_Dom_Query('<fake>' . $output . '</fake>');
$result = $dom->queryXpath("//style[@type='text/css' and @media='screen']");
$this->assertCount(1, $result, "Style tag for inline stylesheet not found.");
$this->assertContains($style, $output);
}
开发者ID:emhoracek,项目名称:Omeka,代码行数:11,代码来源:DisplayCssTest.php
示例11: getDownloads
/**
* Get the list of downloads from Jdownloader
* @return array of Application_Model_JDownloaderPackage
*/
public function getDownloads()
{
if ($this->options->get('nightly', false)) {
$data = $this->sendRawCommand("/get/downloads/all/list");
} else {
$data = $this->sendRawCommand(self::CMD_GET_DOWNLOADS_ALL_LIST);
}
// time to parse xml
// WHILE NOT DOWNLOADING
/*
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<jdownloader>
<package package_ETA="~" package_linksinprogress="0" package_linkstotal="1" package_loaded="0 B" package_name="Added 1298019679499" package_percent="0,00" package_size="82.11 MB" package_speed="0 B" package_todo="82.11 MB">
<file file_hoster="megavideo.com" file_name="The Big Bang Theory - 1x02 - The Big Bran Hypothes" file_package="Added 1298019679499" file_percent="0,00" file_speed="0" file_status=""/>
</package>
</jdownloader>
*/
// WHILE DONWLOADING
/*
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<jdownloader>
<package package_ETA="14m:37s" package_linksinprogress="1" package_linkstotal="1" package_loaded="1.52 MB" package_name="Added 1298019679499" package_percent="1,85" package_size="82.11 MB" package_speed="94.00 KB" package_todo="80.59 MB">
<file file_hoster="megavideo.com" file_name="The Big Bang Theory - 1x02 - The Big Bran Hypothes.flv" file_package="Added 1298019679499" file_percent="1,85" file_speed="96256" file_status="ETA 14m:37s @ 94.00 KB/s (1/1)"/>
</package>
</jdownloader>
*/
$xml = new Zend_Dom_Query($data);
if ($this->options->get('nightly', false)) {
$result = $xml->queryXpath('//packages');
} else {
$result = $xml->queryXpath('//package');
}
$packages = array();
while ($result->valid()) {
/* @var $domPackage DOMElement */
$domPackage = $result->current();
$package = new Application_Model_JDownloaderPackage();
$package->setName($domPackage->getAttribute('package_name'))->setETA($domPackage->getAttribute('package_ETA'))->setPercent($domPackage->getAttribute('package_percent'))->setSize($domPackage->getAttribute('package_size'))->setDownloading($domPackage->getAttribute('package_linksinprogress') != '0');
/* @var $domFiles DOMNodeList */
$domFiles = $domPackage->getElementsByTagName('file');
for ($i = 0; $i < $domFiles->length; $i++) {
/* @var $domFile DOMElement */
$domFile = $domFiles->item($i);
$file = new Application_Model_JDownloaderFile();
$file->setName($domFile->getAttribute('file_name'))->setHoster($domFile->getAttribute('file_hoster'))->setPercent($domFile->getAttribute('file_percent'))->setDownloading($domFile->getAttribute('file_status') != '');
// add file inside the package
$package->appendFile($file);
}
// add package in the list
$packages[] = $package;
$result->next();
}
return $packages;
}
开发者ID:google-code-backups,项目名称:vlc-shares,代码行数:58,代码来源:JDownloader.php
示例12: links
/**
* @description Searches for a line in the searcher
* @param string $lookIn
* @param string $searchString ('google','yandex','rambler','mail')
* @author makinder, Se#
* @version 0.0.2
* @changeLog
* 0.0.2 configurable urls
*/
public function links($resource, $string, $urls = array())
{
$urls = empty($urls) ? self::$urls : $urls;
$urls = self::insertString($urls, $string, '$string');
if (isset($urls[$resource])) {
$url = $urls[$resource];
} else {
return false;
}
$dom = new Zend_Dom_Query(file_get_contents($url));
return $dom->query('a');
}
开发者ID:nurikk,项目名称:EvilRocketFramework,代码行数:21,代码来源:Parser.php
示例13: getCaptcha
/**
* Gets captcha word
*
* @param string $html
* @return array
*/
public function getCaptcha($html)
{
$dom = new Zend_Dom_Query($html);
$id = $dom->query('#captcha-id')->current()->getAttribute('value');
foreach ($_SESSION as $key => $value) {
if (preg_match("/Zend_Form_Captcha_(.*)/", $key, $regs)) {
//if (ereg("Zend_Form_Captcha_(.*)", $key, $regs)) {
if ($regs[1] == $id) {
return array('id' => $id, 'input' => $value['word']);
}
}
}
}
开发者ID:uglide,项目名称:zfcore-transition,代码行数:19,代码来源:RegisterControllerTest.php
示例14: test11RetrieveConceptFiletrStatus
public function test11RetrieveConceptFiletrStatus()
{
// Use API to search for concept and filter on status
// todo: test additionele zoek parameters
print "\n" . "Test: get concept via filters";
$client = Authenticator::authenticate();
//prepare and send request
$uri = BASE_URI_ . '/public/api/find-concepts?q=prefLabel:' . CONCEPT_prefLabel . '&status:' . CONCEPT_status_forfilter . '&tenant:' . TENANT . '&inScheme:' . CONCEPT_schema_forfilter;
print "\n filtered request's uri: " . $uri . "\n";
$client->setUri($uri);
$client->setConfig(array('maxredirects' => 0, 'timeout' => 30));
$client->SetHeaders(array('Accept' => 'text/html,application/xhtml+xml,application/xml', 'Content-Type' => 'application/xml', 'Accept-Language' => 'nl,en-US,en', 'Accept-Encoding' => 'gzip, deflate', 'Connection' => 'keep-alive'));
$response = $client->request(Zend_Http_Client::GET);
// analyse respond
print "\n get status: " . $response->getMessage() . "\n";
$this->AssertEquals(200, $response->getStatus());
$namespaces = array("rdf" => "http://www.w3.org/1999/02/22-rdf-syntax-ns#", "skos" => "http://www.w3.org/2004/02/skos/core#", "openskos" => "http://openskos.org/xmlns/openskos.xsd");
$dom = new Zend_Dom_Query();
$dom->setDocumentXML($response->getBody());
$dom->registerXpathNamespaces($namespaces);
$elem = $dom->queryXpath('/rdf:RDF');
$this->assertEquals(XML_ELEMENT_NODE, $elem->current()->nodeType, 'The root node of the response is not an element');
$this->assertEquals(1, $elem->current()->getAttribute("openskos:numFound"));
$resDescr = $dom->queryXpath('/rdf:RDF/rdf:Description');
$i = 0;
$l = $resDescr->count();
$resDescr->rewind();
while ($i < $l) {
$labels = $resDescr->current()->getElementsByTagName("altLabel");
//print "\n val:" . $labels ->item(0) ->textContent;
$randomn = rand(0, 4096);
$labels->item(0)->nodeValue = "test-1-" . $randomn;
$doc = $resDescr->current()->ownerDocument;
$xml = $doc->saveXML();
var_dump($xml);
// try $newdom isntead of $dom, which can be corrupted
//$dom = new DOMDocument('1.0', 'utf-8');
//$rdf = $dom -> createElement("rdf:RDF");
//$dom ->importNode($newDescr, TRUE);// appendChild($rdf);
//$rdf ->appendChild($newDescr);
//$xml = $dom->saveXML();
//var_dump($xml);
$client->setUri(BASE_URI_ . "/public/api/concept?");
$client->setConfig(array('maxredirects' => 0, 'timeout' => 30));
$response = $client->setEncType('text/xml')->setRawData($xml)->setParameterGet('tenant', TENANT)->setParameterGet('collection', COLLECTION_1_code)->setParameterGet('key', API_KEY)->request(Zend_Http_Client::PUT);
print "\n Update response message: " . $response->getMessage();
$this->AssertEquals(200, $response->getStatus(), 'Update request returned worng status code');
$resDescr->next();
$i++;
}
}
开发者ID:OpenSKOS,项目名称:phpunittests,代码行数:51,代码来源:UpdateConcept.php
示例15: checkConnection
/**
* Check the connection
*/
public function checkConnection()
{
//If not login properly the construct launch an exception
$connection = false;
$urls = array();
$urls[] = new Oara_Curl_Request('https://affiliates.affutd.com/affiliates/Dashboard.aspx', array());
$exportReport = $this->_client->get($urls);
$dom = new Zend_Dom_Query($exportReport[0]);
$results = $dom->query('.lnkLogOut');
if (count($results) > 0) {
$connection = true;
}
return $connection;
}
开发者ID:garygarside,项目名称:php-oara,代码行数:17,代码来源:AffiliatesUnited.php
示例16: parse_item
function parse_item($node, $defs, $fix)
{
$d = new DOMDocument();
$d->appendChild($d->importNode($node, TRUE));
$zend = new Zend_Dom_Query($d->saveHTML());
//debug($d->saveHTML());
$properties = array();
foreach ($defs->properties as $property => $def) {
if (is_string($def)) {
$def = (object) array('selector' => $def);
}
//debug($def);
if ($def->selector) {
$t = array();
foreach ($zend->query($def->selector) as $selected) {
$t[] = $selected;
}
$item = $t[0];
} else {
$item = $node;
}
if (!$item) {
continue;
}
if ($def->derived) {
$data = $properties[$def->derived];
} else {
$data = format($item, $def);
}
if (function_exists($fix)) {
$data = call_user_func($fix, $property, $data);
}
if ($def->date) {
$data = strtodate($def->date, $data);
}
$properties[$property] = $data;
}
if (!($properties['dc:identifier'] && $properties['dc:date'] && $properties['dc:title'])) {
return FALSE;
}
$properties['dc:identifier'] = base_url($properties['dc:identifier']);
if (!$properties['start']) {
$properties['start'] = strtotime($properties['dc:date']);
}
if (!$properties['end'] && is_numeric($properties['start'])) {
$properties['end'] = $properties['start'] + 3600;
}
// 1hr
return $properties;
}
开发者ID:hubgit,项目名称:ecsstract,代码行数:50,代码来源:scrape.php
示例17: deleteBasePathUrl
/**
* Removes the base path of the URL to HTML resources
*
* @param string $html
* @return string|bool If error, then output FALSE
*/
protected function deleteBasePathUrl($html)
{
//$domHtml
$str_begin = '<?xml version="1.0" encoding="utf-8"?>' . "\n" . '<body>';
$str_end = '</body>';
//---------------------------
$filtrHtmlEntities = new Default_Form_Filter_HtmlEntities();
$html = $filtrHtmlEntities->filter($html);
$html = $str_begin . $html . $str_end;
// Check for correct XML
$domDoc = new DOMDocument('1.0', 'utf-8');
$success = $domDoc->loadXML($html);
if (!$success) {
return FALSE;
}
// Correct code
$domQuery = new Zend_Dom_Query();
$domQuery->setDocumentXml($html, "utf-8");
foreach (self::$tags as $tag => $attr) {
$results = $domQuery->query($tag);
if ($results->count()) {
foreach ($results as $result) {
// $result variable is of DOMElement type
if ($result->hasAttribute($attr)) {
$value = $result->getAttribute($attr);
$st = new Default_Plugin_String($value);
if ($st->beginsWith('/')) {
// it was: /zf-myblog/public/pic/1.gif
// it is: /pic/1.gif
$baseURL = Default_Plugin_SysBox::getBaseURL();
$value = str_replace($baseURL, '', $value);
$result->setAttribute($attr, $value);
} else {
// it was: https://mysite.com:8080/zf-myblog/public/pic/1.gif
// it is: /pic/1.gif
$hostPortBaseURL = Default_Plugin_SysBox::getHostPortBaseURL();
$value = str_replace($hostPortBaseURL, '', $value);
$result->setAttribute($attr, $value);
}
}
}
$domDoc = $results->getDocument();
$html = $domDoc->saveXml();
$domQuery->setDocumentXml($html, "utf-8");
}
}
$html = str_replace($str_begin, '', $html);
$html = str_replace($str_end, '', $html);
return $html;
}
开发者ID:bsa-git,项目名称:zf-myblog,代码行数:56,代码来源:DeleteBasePathUrl.php
示例18: checkConnection
/**
* Check the connection
*/
public function checkConnection()
{
//If not login properly the construct launch an exception
$connection = true;
$urls = array();
$urls[] = new Oara_Curl_Request('https://www.winneraffiliates.com/', array());
$exportReport = $this->_client->get($urls);
$dom = new Zend_Dom_Query($exportReport[0]);
$results = $dom->query('#lgUsername');
if (count($results) > 0) {
$connection = false;
}
return $connection;
}
开发者ID:garygarside,项目名称:php-oara,代码行数:17,代码来源:WinnerAffiliates.php
示例19: assertions
private function assertions($response)
{
$dom = new Zend_Dom_Query();
$dom->setDocumentXML($response->GetBody());
// comparing test xml with teh data from the xml from the file
// Asserting
// Assert - 1
$results1 = $dom->query('skos:notation');
$this->AssertEquals(1, count($results1));
$this->AssertEquals(self::$notation, $results1->current()->nodeValue);
// Assert - 2
$results2 = $dom->query('skos:inScheme');
$this->AssertEquals(1, count($results2));
$this->assertStringStartsWith("http://data.beeldengeluid.nl/gtaa/Onderwerpen", $results2->current()->getAttribute('rdf:resource'));
}
开发者ID:OpenSKOS,项目名称:phpunittests,代码行数:15,代码来源:ExportConcept2Test.php
示例20: testImport
public function testImport()
{
print "\n" . "Testing import ... ";
$response = RequestResponse::ImportConceptRequest(self::$client, self::$postData, self::$boundaryNumeric);
Logging::var_error_log("\n Response body ", $response->getBody(), __DIR__ . "/ImportResponse.html");
$this->AssertEquals(200, $response->getStatus(), 'Failed to import concept');
$output = array('0' => "The ouput of sending jobs: ");
$retvar = 0;
$sendjob = exec(PHP_JOBS_PROCESS, $output, $retvar);
// check via spraql query
//$sparqlResult = $this ->sparqlRetrieveTriplesForNotation(self::$notation);
//var_dump($sparqlResult);
self::$client->setUri(BASE_URI_ . '/public/api/find-concepts?q=prefLabel:' . self::$prefLabel);
$responseGet = self::$client->request(Zend_Http_Client::GET);
$this->AssertEquals(200, $responseGet->getStatus(), $responseGet->getMessage());
$dom = new Zend_Dom_Query();
$namespaces = RequestResponse::setNamespaces();
$dom->registerXpathNamespaces($namespaces);
$xml = $responseGet->getBody();
$dom->setDocumentXML($xml);
var_dump($xml);
$results1 = $dom->query('rdf:RDF');
$this->AssertEquals(1, $results1->current()->getAttribute('openskos:numFound'));
$results2 = $dom->queryXpath('/rdf:RDF/rdf:Description');
$this->AssertEquals(1, count($results2));
}
开发者ID:OpenSKOS,项目名称:phpunittests,代码行数:26,代码来源:ImportConcept2Test.php
注:本文中的Zend_Dom_Query类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论