file-get-contents

file_get_contents does not work on port 8282

情到浓时终转凉″ 提交于 2019-12-21 22:43:45
问题 I got the following basic script who make a basic POST request (I just want to make it work, after I'll add more stuff) : # Variables $URL = 'http://******:8282/api/incoming_shipment/'; $postdata = http_build_query( array( 'contract_id' => 'Showcare-R124276', 'shipment_from' => 'Montréal', 'shipment_to' => 'Chicago', 'shipping_time' => '2012-08-16 14:51:01', 'tracking_cie' => 'Poste Canada', 'tracking_type' => 'Standard', 'tracking_number' => 'EP645 9834 123 9773' ) ); $opts = array('http' =>

file_get_contents from multiple url

泪湿孤枕 提交于 2019-12-21 21:38:25
问题 i want to save page content to files from multiple url. For start i have sites url from array $site = array( 'url' => 'http://onesite.com/index.php?c='.$row['code0'].'&o='.$row['code1'].'&y='.$row['code2'].'&a='.$row['cod3'].'&sid=', 'selector' => 'table.tabel tr' ); For saveving files I have try: foreach($site as $n) { $referer = 'reffername'; $header[] = "Accept: text/xml,application/xml,application/json,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5"; $header[]

file_get_contents displaying image incorrectly

怎甘沉沦 提交于 2019-12-21 20:54:35
问题 I'm trying to display generic websites and URLs as part of my own site. Here's part of the relatively simple code I'm using: browse.php <? $enteredurl = $_GET["url"]; $page = file_get_contents($enteredurl); echo $page; ?> Ignoring the fact that some links/images will not work if the URls are relative rather than absolute, this works just fine. Pages are accessed using $_GET, something like browse.php?url=http://itracki.com The webpage will display as expected. However, when I'm trying to get

file_get_contents(): php_network_getaddresses: getaddrinfo failed

落爺英雄遲暮 提交于 2019-12-21 07:35:08
问题 I'm trying to update some values from one server to another server with a cron job. I use file_get_contents(). The strange thing is that this fails occasionally. One minute it works, another minute it won't work. I receive these two errors: PHP Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: Name or service not known PHP Warning: file_get_contents(): failed to open stream: php_network_getaddresses: getaddrinfo failed: Name or service not known and: PHP Warning:

PHP - Safe way to download large files?

与世无争的帅哥 提交于 2019-12-21 06:18:38
问题 Information There are many ways to download files in PHP, file_get_contents + file_put_contents, fopen, readfile and cURL. Question? When having a large file, let's say 500 MB from another server / domain, what is the "correct" way to downloaded it safe? If connection failes it should find the position and continue OR download the file again if it contains errors. It's going to be used on a web site, not in php.exe shell. What I figured out so far I've read about AJAX solutions with progress

Simple JSON request in PHP

隐身守侯 提交于 2019-12-21 03:42:11
问题 I have the following json country_code({"latitude":"45.9390","longitude":"24.9811","zoom":6,"address":{"city":"-","country":"Romania","country_code":"RO","region":"-"}}) and i want just the country_code, how do i parse it? I have this code <?php $json = "http://api.wipmania.com/jsonp?callback=jsonpCallback"; $jsonfile = file_get_contents($json); var_dump(json_decode($jsonfile)); ?> and it returns NULL, why? Thanks. 回答1: <?php $jsonurl = "http://api.wipmania.com/json"; $json = file_get

Google Drive GET_CONTENT intent read file

别等时光非礼了梦想. 提交于 2019-12-20 11:48:26
问题 I have an app on android that does some file sharing using cloud storages like dropbox. To start sharing I throw android.intent.action.SEND . On the list that is shown I see the Google Drive app (previously installed), so I try sending the file to it - it works ok, the file appears in the Drive list. Then, on another device I want to read this file. I throw the android.intent.action.GET_CONTENT intent, choose Drive and then don't know how to get to file. I receive an Uri something like this:

Does file_get_contents() use a cache?

夙愿已清 提交于 2019-12-20 05:21:31
问题 If I write: $mypage=file_get_contents("www.mywebsite.com/mypage.htm"); The first time I run the script, file_get_contents() will surely make a HTTP request to www.mywebsite.com for mypage.htm, and get a response with the content of mypage.htm. But every next time I run the script, will file_get_contents() get the real file on www.mywebsite.com? Or it has some kind of cache on the localhost? 回答1: It does not . However, there will be a speed-up because the DNS resolution step may be faster on

File_get_contents not working?

被刻印的时光 ゝ 提交于 2019-12-19 17:33:02
问题 I am using cakephp. I am trying get data from facebook using file_get_contents. I get a warning. Warning (2): file_get_contents() [function.file-get-contents]: URL file-access is disabled in the server configuration Warning (2): file_get_contents(https://graph.facebook.com/XXXXXXX/?access_token=111978178XXXXXX|2.lg65A3c0atficNsFcf7Rog__.3600.12799XXXX-1000 Is there any way to get the data? I appreciate any help. Thanks. 回答1: This is a configuration issue on your server. In your php.ini you

file_get_contents shows unexpected output while reading a file

送分小仙女□ 提交于 2019-12-19 08:29:24
问题 I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print "<img src=\"data:image/jpg;base64,".$contents."\"/>"; Where $filename is a local text file with the base64 image. The output is as follows : <img src="data:image/jpg;base64,/9j/4A..... (the rest of the file)...." /> And obiously the image is not rendered, but where does  come from ? It is not in the text file. If removed, the image is displayed