Cannot access API using PHP

Discussion in 'PHP' started by hussey, Sep 3, 2019.

  1. hussey

    hussey New Member

    Joined:
    Sep 2, 2019
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    Trying to develop a personal weather page - just for wife.

    URL "get_web_page("api.apixu.com/v1/forecast.json?days=5&key=95f8753a9d5f4d25a8d145502190605 &q=34232);"

    When I request the above, I get an error page. When I simply paste the URL into a browser address window, the JSON file comes back as hoped. I've been told by ISP support that the problem seems to be in the way I'm using PHP. However, it worked a couple of weeks ago and then just changed to what I see now.

    Any help or advice will be appreciated!
     

    Attached Files:

    • API.JPG
      API.JPG
      File size:
      106 KB
      Views:
      608
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    PHP doesn't have a get_web_page function define. You need to define that function as well. Looking at the screenshot it looks like Cloudflare is blocking the call because of cookies.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice