I am new to these thing. what are the difference between fsockopen, curl,and file_get_contents. Can someone explain in simple way. I went through the manual, but i could not sortout the difference between them.
php fsockopen curl file_get_contents
2.2k Views Asked by aparna At
1
There are 1 best solutions below
Related Questions in CURL
- No responses from google places text search api
- compare python requests with curl
- file_get_contents not working on my server but works fine anywhere else?
- Converting curl command to iOS
- cURL PHP code redirect after success
- curl command cannot get contents from api.github, but the network is fine
- PHP cURL Request for Web Service Returning Error
- How to convert CURL command to Swift
- curl command don't work in some cases
- Silence output curl_setopt_array
- Validating a login using PHP
- Curl return 0 but doesn't not work
- Pg backups curl latest dump from Heroku
- Unable to install RabbitMQ using puppet due to curl error
- cleaning a post URL from an Array
Related Questions in FILE-GET-CONTENTS
- PHP: converting fopen to file_get_contents?
- Use File_Get_Contents to grab site, then remove header and display site?
- php file_get_content /curl no response
- regex pattern to find this particular string in file_get_contents in PHP
- PHP - file_get_contents failed to open stream: Connection closed?
- Why is file_get_contents can get remote data while PHP Curl gives blank page?
- PHP cURL vs. file_get_contents when using proxy
- php check if remote image cant be displayed
- Emulate form submission with PHP
- Load HTML file and force UTF8 with PHP
- URL working with & but not &
- create php cache with file_get_contents
- Cannot read local file with accented characters using PHP file_get_contents
- Getting DOM elements of html from file_get_contents
- file_get_contents last record
Related Questions in FSOCKOPEN
- PHP ipv6 support in fsockopen()
- Use fsockopen with proxy to detect valid mails
- How to fake a resourse for a unit test in PHP?
- fsockopen timing out due to no new line being added to reply
- Why is my programmatic WHOIS response different from checking on whois.net?
- Check whether outbound port on server is open
- PHP fsockopen subfolder
- fsockopen unable to connect error with remote css file
- Read http status code by fsockopen
- php fsockopen how to know if connection is alive
- fsockopen port checking script
- Connecting to a SMTP server with fsockopen from behing a proxy with PHP
- autentication system in php using fsockopen curl
- php fsockopen curl file_get_contents
- The address of the page which referred the user agent to the current page. when data is send by fsockopen
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
A long time ago, if you wanted an easy time, you had to use curl extension.
If your host did not provide it, then you were stuck using fsockopen, which is more tedious and finicky, though very versatile.
In more recent versions of PHP, they gave you file_get_contents(), which can save a lot of lines of fopen/fsockopen code for doing something simple like getting the content of a file.
Now, whenever you want to do a simple read of a file, use file_get_contents(). If it is a remote file, you can still get it if your allow_url_fopen in php.ini is set to true.
If allow_url_fopen is not true and you can't change it and you need a remote file, then use curl. Curl can also put things in remote files. file_put_contents() can also put things in files and save some lines of code.
Use fsockopen when you need to do fancy arbitrary things over a network connection, like wait for a response, send more data, count bytes, connect to weird ports, etc.