0

I need to be able to include a variable to the url so when i use file_get_html i can get to the specific page i need.

Here is what i am trying as a test.

$activity= 'com.google.com';

$html = file_get_html("https://play.google.com/store/apps/details?id=".$activity) or die('this is not a valid url');
echo $html;

The activity is what will change when running my mysql_fetch_array. I have tried single quotes, double quotes no quotes and cannot come up with a solution.

I just get this is not a valid url

If i use this, it works because its replacing just the base url

$a = 'google.com';
$b = "http://" . $a . "/";
$html = file_get_html($b)

It seems to only be an issue when accessing a specific url

UPDATE The above wasn't working because it was not a valid url. when entering a valid url, it work.

However, putting in my real world scenario it says not a valid url

$html = file_get_html("https://play.google.com/store/apps/details?id=".$row['activity']) or die('this is not a valid url');
3
  • Maybe the URL refers to a non existing page? Commented Sep 3, 2014 at 15:22
  • 1
    Although it doesn't seem to be the problem here, you should always encode the variables you want to use in urls: ....id=".urlencode($activity) .... That way characters in query variables will not be able to break / invalidate your url. Commented Sep 3, 2014 at 15:23
  • The issue with the above example was because non existing page. however when i put this into my real world scenario i get same issue. here is the code $html = file_get_html("play.google.com/store/apps/…) or die('this is not a valid url'); Commented Sep 3, 2014 at 15:28

1 Answer 1

1

i think its about the https of your first url seems like file_get_html having issues with validate certificates

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.