Questions tagged as 'php'

2
answers

How do I know the time and date of a location with PHP?

I want to store in a variable the current time of Portugal and in another variable the current date of Portugal. How can I do this?     
asked by 23.12.2016 / 17:21
3
answers

Why do libraries use "! function_exists ('function') "whenever there is a declaration of a function?

I have already used several PHP libraries and I have noticed that they always use the same statement whenever there is a declaration of a new function. if (! function_exists('funcao')) { function funcao($arg) { } } That is, the fun...
asked by 06.03.2017 / 17:09
2
answers

Read text file and play content in positions in an array!

I am in doubt that I can read a .txt file and store its data in different positions in a array . The file is saved as follows: city=A(100,80); city=B(160,70); city=C(110,50); city=D(140,120); city=F(155,40); city=G(210,60); cit...
asked by 24.08.2016 / 01:17
1
answer

Problem with cURL, get message body even with http! = 200

I have a request in my API: $ch = curl_init(); curl_setopt( $ch, CURLOPT_URL, 'link da api'); curl_setopt( $ch, CURLOPT_FAILONERROR, true ); curl_setopt( $ch, CURLOPT_TIMEOUT, 10 ); curl_setopt( $ch, CURLOPT_POST, 1); curl_setopt( $ch, CURLOPT...
asked by 06.10.2016 / 17:04
1
answer

Why can not a Trait implement an interface?

Why can not a Trait implement an interface in PHP?     
asked by 10.10.2016 / 15:30
1
answer

Update for PHP 7 ubuntu

After updating PHP on my Ubuntu server my phpinfo() continues to show the previous version 5.5 even when I run php -v (returns version 7.0). I've tried restarting apache and php7.0-fpm and it did not work.     
asked by 06.12.2016 / 18:49
1
answer

Facebook login php Auth returning dialog / oauth? client_id in url

I am making my application for login on Facebook, however it returns with GET in url ?code=etc... Before it was working normally, I use Facebook's class . See: $facebook = new Facebook(array( 'appId' => APP_ID,...
asked by 23.02.2015 / 01:33
1
answer

Saving data to a global array

I'm studying PHP, and so far I've developed a small system that "mounts" site views and so on. But I came across an extremely annoying problem that I can not solve. I need a function to show errors that occur in the system. The problem is...
asked by 23.12.2014 / 17:58
3
answers

Picking value created at runtime

I'm trying to fetch a value contained in a tag ( span ) located in another domain using PHP and JavaScript. There are cases where I can get the required value but most of the value returned is null . I believe that when I give file_get_conte...
asked by 03.02.2015 / 11:41
2
answers

What exception should I post according to each situation?

In PHP, we have several types of exceptions that can be thrown. Among them: BadFunctionCallException BadMethodCallException DomainException InvalidArgumentException LengthException LogicExc...
asked by 09.02.2015 / 19:29