Coder Social home page Coder Social logo

punkave / phpquery Goto Github PK

View Code? Open in Web Editor NEW
430.0 430.0 155.0 359 KB

This is phpQuery, a PHP port of jQuery selectors, super useful for DOM traversal and functional testing. Originally by Tobiasz Cudnik, who released it on Google Code. We forked it because we need some bug fixes and no commits have been made upstream for quite some time. Please share your phpQuery fixes with us!

PHP 98.98% JavaScript 1.02%

phpquery's Introduction

This is phpQuery, a PHP port of jQuery selectors, super useful for DOM traversal 
and functional testing.

It is originally by Tobiasz Cudnik:

http://code.google.com/p/phpquery/

And was released under the MIT license.

We've cloned it into github because no issues have been fixed upstream in the 
last two years and we needed to fix a bug relating to the serialize()
method to get our functional tests to work. You can find our github
repository here:

https://github.com/punkave/phpQuery

"What did you fix?" 

Our initial commit includes a fix for the serialize() method, crucial to do 
form submissions (a big deal for functional testing). See the commit history
in github for any later changes.

- P'unk Avenue

phpquery's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

phpquery's Issues

phpQuery eq(-2)

dont work selector with minus..
phpQuery eq(-2)
example: echo $html->find('div.bx_pagination_page > ul > li > a:eq(-2)')->html();

2017-04-20_110204

appendTo

$doc = phpQuery::newDocument();

$div = pq('

')->appendTo($doc);
$div->append('some text');

$div = pq('

')->appendTo($doc);
$div->append('some text');

phpQuery::newDocument();

$div = pq('

')->appendTo($doc);
$div->append('some text');

echo htmlentities($doc);

The last append will not work if phpQuery::newDocument() called.

how can I filter some nodes?

HI !
I got a little problem here. I'm parsing JSON data from Reddit (eg. https://www.reddit.com/r/Chilledout.json); and I need to setup a function that would filter the data to remove every post that does not have a media attribute.

Something that can't be changed in my code is that this function receives a phpQuery node; and should return one too.

function get_track_nodes($body_node){

    $selector = '>data >children';
    $options = array(
        'omit_xml_declaration'      => true,
        'ignore_parser_warnings'    => true,
        'convert_from_encoding'     => 'auto',
        'convert_to_encoding'       => 'UTF-8' //match WP database (or transients won't save)
    );
    $post_nodes = qp( $body_node, null, $options )->find($selector);

    foreach($post_nodes as $key=>$node) {
        /*
        here's my problem:  
        How could I detect nodes that do not have a media attribute, 
        and how could I remove them from $post_nodes ? */
    }

    return $post_nodes;
}

How could I achieve this ?
Thanks !

not working: ->find() method with direct child selector

On an item node like this one,

<item>
    <artist>
        <name>Niagara</name>
    </artist>
    <name>Pendant que les champs brûlent</name>
</item>

$node->find('> name');

gets those nodes

<name>Niagara</name>

<name>Pendant que les champs brûlent</name>

while it should only get this one

<name>Pendant que les champs brûlent</name>

Is that a bug ?

I could use

$node->children('name');

But I want to be able to select NOT only direct descendants.

How could I do ?
Thanks.

Scrapt link dynamic

hi, I'm trying to scrapear a dynamic link and then mostralo visitors to my site can download what has that link. The inconveniete that I have is that the link is unique for each client when I try the link and provide it scrapear my clients gives error because the link is being generated for my server and not for my clients.

I wonder if you could help me as making a request to a specific IP.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.