Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can't get a website (help, question) #23

Closed
NotASenior opened this issue Nov 15, 2017 · 1 comment
Closed

can't get a website (help, question) #23

NotASenior opened this issue Nov 15, 2017 · 1 comment

Comments

@NotASenior
Copy link

NotASenior commented Nov 15, 2017

Hey, I have this code, it works perfectly on localhost, but it doesn't on my server

Can you help me?

Note: I know this is not a cute code, it is just for the example

$doc = hQuery::fromUrl(
    'http://www.submanga.com/Naruto'
  , array(
        'Accept'     => 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
        'User-Agent' => 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36',
    )
);
@duzun
Copy link
Owner

duzun commented Nov 16, 2017

Have you tried duzun.me/hq?

It looks like you have an issue with PHP or server configuration, as hQuery on my server can access this page too.

hQuery::fromUrl() uses fsockopen to fetch document's contents over network, so make sure it can work properly on your server.
Also compare the results of stream_get_transports() both on your server and localhost to see what's missing.

Alternatively you can use any other method/library to fetch HTML from that link and feed it into hQuery::fromHTML($html, $url).

Cheers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants