RE: get_file_contents php 06-08-2014, 12:52 AM
#2
I think you mean file_get_contents and it will retrieve URLs if that is enabled in the php config(php.ini).
You'll need to parse the data you want from the response if you only want part of it.
If you really must only have partial data sent back to you then you'll have to send some special headers to the server to tell it to only send certain bytes back: http://www.w3.org/Protocols/rfc2616/rfc2...l#sec14.35
If the data is only the first * bytes then you can use fopen to a url and only read that many bytes or using cURL you can set a callback to cetermine how many bytes have been read and abort the connection after so many.
Is there a particular reason why you can't just parse the information out from the entire page? If you can share more about what you actually want to do we can potentially provide an alternative method besides what you are trying.
You'll need to parse the data you want from the response if you only want part of it.
If you really must only have partial data sent back to you then you'll have to send some special headers to the server to tell it to only send certain bytes back: http://www.w3.org/Protocols/rfc2616/rfc2...l#sec14.35
If the data is only the first * bytes then you can use fopen to a url and only read that many bytes or using cURL you can set a callback to cetermine how many bytes have been read and abort the connection after so many.
Is there a particular reason why you can't just parse the information out from the entire page? If you can share more about what you actually want to do we can potentially provide an alternative method besides what you are trying.
(This post was last modified: 06-08-2014, 12:54 AM by miiike980.)
![[+]](https://sinister.ly/images/modern/collapse_collapsed.png)