file-get-contents

Which to use? file_get_contents, file_get_html, or cURL? [closed]

守給你的承諾、 提交于 2019-12-12 02:04:44
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 5 years ago . I need to scrape data from a table on a web page. I'd then like to store this data in an array, so that I can later store it in a database. I'm very unfamiliar with this functionality, so I'd like to use the most simple method possible. Which should I use? file_get_contents , file

PHP file_get_html is not working

大兔子大兔子 提交于 2019-12-12 01:25:00
问题 I have used simple_html_dom library but i can not get HTML content only for 1 URL but i am getting 503 error. Check my below code. $base = 'http://www.amazon.com/gp/offer-listing/B001F0M4K8/ref=dp_olp_all_mbc/183-8463780-9861412?ie=UTF8&condition=new'; echo $html = file_get_html($base); Error : Warning: file_get_contents(http://www.amazon.com/gp/offer-listing/B001F0M4K8/ref=dp_olp_all_mbc/183-8463780-9861412?ie=UTF8&condition=new) [function.file-get-contents]: failed to open stream: HTTP

call url by php and checking if logged in [closed]

时光总嘲笑我的痴心妄想 提交于 2019-12-12 01:08:58
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 7 years ago . Given url ( https://127.0.0.1:8443/example.html <- yes it's secure connection ) is checking if user is logged in (by jboss server) and if so, he has permissions to some content. When I logged in and try to run

Retrieve data from url and save in php

◇◆丶佛笑我妖孽 提交于 2019-12-11 21:04:04
问题 I am trying to retrieve the html from file get contents in php then save it to a php file so I can include it into my homepage. Unfortunately my script isn't saving the data into the file. I also need to verwrite this data on a daily basis as it will be setup with a cron job. Can anyone tell me where I am going wrong please? I am just learning php :-) <?php $richSnippets = file_get_contents('http://website.com/data'); $filename = 'reviews.txt'; $handle = fopen($filename,"x+"); $somecontent =

file_get_contents on file with cyrillic characters and undefined encoding

半腔热情 提交于 2019-12-11 19:52:38
问题 I cannot get cyrillic characters in php from a .txt file with unknown encoding. I tried almost everything I could find on the web. What php function do I need to use get the contents of this file? https://www.dropbox.com/s/w7cex4wiogyytvm/100004-6.txt EDIT Input: $path = WWW_ROOT . 'files' . DS . '100002-6.txt'; $string = file_get_contents($path); debug($string); Output: debug is broken, if I try to save the value to database it fails (BOM does some trouble and the value cannot be saved).

PHP Data Extraction From External Website, Then Write to Database [duplicate]

被刻印的时光 ゝ 提交于 2019-12-11 19:14:24
问题 This question already has answers here : How do you parse and process HTML/XML in PHP? (30 answers) Closed 6 years ago . Just wondering how this would be done. Let's say there's a simple HTML table on an external website, and you have a database with the same structure as that HTML table. I understand that you can use file_get_contents to grab that entire web page. From there, I would assume that you would remove everything from your file_get_contents except for the stuff between the <table><

How to download php generated zip/rar file with file_get_contents

时间秒杀一切 提交于 2019-12-11 17:31:06
问题 I have small issue with php file_get_contents(); i try to download compressed packages from url like "http://mydomain.com?download.php?id=1234" downloading same file with browser works and all headers seems to be ok but through file_get_contents file is empty... 回答1: Don't you mean that it return false ? Anyway if you're download files, it would be better to use the curl library and the HTTP extension. Resources : php.net - curl examples php.net - http extension 回答2: different host and

function.file-get-contents - failed to open stream [duplicate]

别来无恙 提交于 2019-12-11 14:39:10
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: file_get_contents with query string I'm using the file_get_contents function but although returning the correct output, it is still showing this error: Warning: file_get_contents(secure/validate.php?cardnumber=1234567) [function.file-get-contents]: failed to open stream: No error in ... The scenario is card number validation and in validatecard.php there is a simple if statement: if (isset($_GET['cardnumber']) &

How do I write to a file in php?

☆樱花仙子☆ 提交于 2019-12-11 14:12:15
问题 I am getting the source of a page as follows: <? $txt = file_get_contents('http://stats.pingdom.com/file'); echo $txt; ?> and printing it on the screen but to be honest I actually want to replace an existing html file with it every 1 min. (I will be opening the file every 1 min.) How could I do this? 回答1: If you've learned to use file_get_contents() then consider his sister function file_put_contents() $txt = file_get_contents('http://stats.pingdom.com/file'); file_put_contents('/path/to/my

PHP get a div from page x [duplicate]

风流意气都作罢 提交于 2019-12-11 13:59:30
问题 This question already has answers here : How do you parse and process HTML/XML in PHP? (30 answers) Closed 6 years ago . I wanna extract some html from page Y for example site is <head>xxxx</head> <body>....<div id="ineedthis_code"> </div> ...</body> it is possible to do this file_get_contents ?! i need only that div nothing else 回答1: Without using a special library (which is the best way in most cases), you can use the explode-function: $content = file_get_contents($url); $first_step =