php - curl 404 bad request -


I do not want to down the site or use the following php code

 < Code> $ ch = curl_init (); Curl_setopt ($ c, CURLOPT_URL, 'https://help.github.com/articles/why-are-my-commits-linked-to-the-wrong-user'); curl_setopt ($ ch, CURLOPT_NOBODY, true); $ Return_val = curl_exec ($ ch); $ Code = curl_getinfo ($ ch, CURLINFO_HTTP_CODE); Var_dump ($ code);   

This works fine for some sites but some sites like the CURLOPT_URL option get 400 code returns

this URL also does not work < p>

I also tried to add but still not working

What am I doing wrong ???

You want to ask for a HEAD at a specific URL. The server then says that the page / resource does not exist by sending you a 404 response back.

This is not really a client problem, the server says that the page does not exist. If you get a different result without the set (which is sometimes the case), then you can actually convince the server not to properly HTTP compliant, but it will not please anyone.

(Other answers may include details and CURLOPT_RETURNTRANSFER but these are certainly irrelevant here.)

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -