Jump to content

Search the Community

Showing results for tags 'dom xml'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 1 result

  1. Hi guys, I am trying to grab some data from an API by using cURL and DOMDocuments. This is what I have: $username="XXXXX"; $password="XXXX"; $base_url="https://xxxxxx.net/api/"; $href_url="resources/120529-0039/workorders"; $ch = curl_init($base_url . $href_url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY); curl_setopt($ch, CURLOPT_SSLVERSION,3); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_HEADER, false); curl_setopt($ch, CURLOPT_HTTPHEADER, array("Accept"=>"application/json")); curl_setopt($ch, CURLOPT_USERPWD, "$username:$password"); $result = curl_exec($ch); So far so good, at this point if I echo the $result, and look at the source, I would get: <?xml version="1.0" encoding="utf-8"?> <References xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" p3:href="resources/120529-0039/workorders" xmlns:p3="http://www.w3.org/1999/xlink" xmlns="http://xxxxxx.net/Apps/20090225/Entities"> <Link p3:href="workorders/3012-23" p3:title="Brandlarmsprov(mar-dec)" /> <Link p3:href="workorders/3021-27" p3:title="Reservkraft(2:a torsdagen varje månad)" /> <Link p3:href="workorders/4375-1" p3:title="Uppdatering av IBK ritningar efter heltäckande brandlarm." /> </References> I am after the "workorders/3012-23" part. Here it all falls aparat for me, I have been playing around with: $husdjur = new DOMDocument(); $husdjur->loadXML($result); $href = $husdjur->getElementsByTagName('Link')->item(0)->getAttribute('p3:href'); And was able to populate $href with one value, but I want them all. I need the following: $href[0] = "workorders/3012-23" $href[1] = "workorders/3021-27" $href[2] = "workorders/4375-1" and so on... Any thoughts? Thanks!
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.