# Php client for Plex Media Server

**URL:** <https://forums.plex.tv/t/php-client-for-plex-media-server/8049>\
**Category:** Dev/API Corner\
**Tags:** other-dev\
**Created:** [February 27, 2011, 6:45pm UTC](https://forums.plex.tv/t/php-client-for-plex-media-server/8049 "2011-02-27T18:45:29Z")\
**Posts on this page:** 20\
**Page:** 6

<div class="post-metadata">

**Author:** ![eclipsenet2k](https://avatars.discourse-cdn.com/v4/letter/e/bcef8e/32.png) [@eclipsenet2k](https://forums.plex.tv/u/eclipsenet2k)\
**Post date:** [January 17, 2012, 4:31pm UTC](https://forums.plex.tv/t/php-client-for-plex-media-server/8049/101 "2012-01-17T16:31:47Z")

</div>

> [@](#):
>
> Actually I have it even worse :)  
>   
> If I set $config['plex\_url'] = 'http://87.63.xx.xx:32401'; (which is my external IP and port) I get no posters and no playback, just download.  
> If I set $config['plex\_url'] = 'http://192.168.xx.xx:32400'; (which is the NAS's internal IP) I get it all at home and nothing externally.  
>   
> Very wierd.

  
  
There is a simple reason for this, the plex\_url value is what is embedded in the HTML source as the "src" for images and since you are trying to access a resource that is private to your network (setting 2 above) your browser will get errors that it cannot find the resource or server since 192.168.x.x will not resolve outside of the private network. Hence why it needs to be an externally available/routeable address.

---

<div class="post-metadata">

**Author:** ![ziggimon](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/ziggimon/32/305_2.png) [@ziggimon](https://forums.plex.tv/u/ziggimon)\
**Post date:** [January 17, 2012, 5:14pm UTC](https://forums.plex.tv/t/php-client-for-plex-media-server/8049/102 "2012-01-17T17:14:53Z")

</div>

Hmm… does not explain why img files are not loaded when I’m away from home with the external ip set and router is set up so I can use PMS remotely from my android phone. I can still watch and download files, so that part works. Why can’t images be loaded remotely.  
  
  
  
/Mark  
  
  
  
Update just saw your other post. Will wait for code update.

---

<div class="post-metadata">

**Author:** ![eclipsenet2k](https://avatars.discourse-cdn.com/v4/letter/e/bcef8e/32.png) [@eclipsenet2k](https://forums.plex.tv/u/eclipsenet2k)\
**Post date:** [January 24, 2012, 4:44pm UTC](https://forums.plex.tv/t/php-client-for-plex-media-server/8049/103 "2012-01-24T16:44:54Z")

</div>

Just posting to let you know I’ve not disappeared, just been very busy! I will let you know when there is more to play with!!

---

<div class="post-metadata">

**Author:** ![iPerplexed](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/iperplexed/32/844_2.png) [@iPerplexed](https://forums.plex.tv/u/iPerplexed)\
**Post date:** [January 24, 2012, 5:09pm UTC](https://forums.plex.tv/t/php-client-for-plex-media-server/8049/104 "2012-01-24T17:09:29Z")

</div>

> [@](#):
>
> Just posting to let you know I've not disappeared, just been very busy! I will let you know when there is more to play with!!

  
  
Thanks Eclipse. Just to throw some options out there; I'd be happy to do a Google Hangout to discuss the technical hurdles here. I'd love to lend a hand in development. Let me know if you're interested.  
  
Cheers man!  
- Brad

---

<div class="post-metadata">

**Author:** ![kizer9\_hotmail.com](https://avatars.discourse-cdn.com/v4/letter/k/ed655f/32.png) [@kizer9\_hotmail.com](https://forums.plex.tv/u/kizer9_hotmail.com)\
**Post date:** [January 27, 2012, 3:11pm UTC](https://forums.plex.tv/t/php-client-for-plex-media-server/8049/105 "2012-01-27T15:11:41Z")

</div>

Anyone know why I get the below error when running under xampp in windows. I am running PMS 0.9.5.2  
  
  
  
Fatal error: Call to undefined function curl\_init() in C:\xampp\htdocs\plex\plex\_over\models\plex.php on line 216

---

<div class="post-metadata">

**Author:** ![eclipsenet2k](https://avatars.discourse-cdn.com/v4/letter/e/bcef8e/32.png) [@eclipsenet2k](https://forums.plex.tv/u/eclipsenet2k)\
**Post date:** [January 30, 2012, 9:08pm UTC](https://forums.plex.tv/t/php-client-for-plex-media-server/8049/106 "2012-01-30T21:08:10Z")

</div>

> [@](#):
>
> Anyone know why I get the below error when running under xampp in windows. I am running PMS 0.9.5.2  
>   
> Fatal error: Call to undefined function curl\_init() in C:\xampp\htdocs\plex\plex\_over\models\plex.php on line 216

  
  
Your are missing the cURL extension for PHP. Look at the documentation for XAMPP and PHP. It is probably bundled with your install but not set up in the php.ini file but it might not be.

---

<div class="post-metadata">

**Author:** ![kizer9\_hotmail.com](https://avatars.discourse-cdn.com/v4/letter/k/ed655f/32.png) [@kizer9\_hotmail.com](https://forums.plex.tv/u/kizer9_hotmail.com)\
**Post date:** [February 1, 2012, 1:11pm UTC](https://forums.plex.tv/t/php-client-for-plex-media-server/8049/107 "2012-02-01T13:11:30Z")

</div>

> [@](#):
>
> Your are missing the cURL extension for PHP. Look at the documentation for XAMPP and PHP. It is probably bundled with your install but not set up in the php.ini file but it might not be.

  
  
Thanks I will take a look.

---

<div class="post-metadata">

**Author:** ![madsmooth](https://avatars.discourse-cdn.com/v4/letter/m/e9a140/32.png) [@madsmooth](https://forums.plex.tv/u/madsmooth)\
**Post date:** [February 20, 2012, 11:25pm UTC](https://forums.plex.tv/t/php-client-for-plex-media-server/8049/108 "2012-02-20T23:25:39Z")

</div>

> [@](#):
>
> There is a simple reason for this, the plex\_url value is what is embedded in the HTML source as the "src" for images and since you are trying to access a resource that is private to your network (setting 2 above) your browser will get errors that it cannot find the resource or server since 192.168.x.x will not resolve outside of the private network. Hence why it needs to be an externally available/routeable address.

  
  
  
So I am having this same external problem with no images, etc. I think I can provide a little more information that might be helpful. When I am on my home network I can plug the plexip:32400 into a browser and an xml stream returns from plex with some options defined.   
  
I checked that my port is configured with upnp through my router via plex to be some unique port. When I go to the router's external ip address with the port that is open in my router for plex, I get a 401 unauthorized error. I am assuming that for the images/data to load, this needs to be able to return the xml stream from plex to an external client. It looks like I need some more configuration setting/permissions set up to allow external access to plex's data. Is this related?

---

<div class="post-metadata">

**Author:** ![eclipsenet2k](https://avatars.discourse-cdn.com/v4/letter/e/bcef8e/32.png) [@eclipsenet2k](https://forums.plex.tv/u/eclipsenet2k)\
**Post date:** [February 21, 2012, 2:20am UTC](https://forums.plex.tv/t/php-client-for-plex-media-server/8049/109 "2012-02-21T02:20:36Z")

</div>

Thanks madsmooth, I already know the issue, it is just taking me time to get around to fixing it. I have a lot of other, paid projects right now 🙂  
  
  
  
I’ve not disappeared though!

---

<div class="post-metadata">

**Author:** ![AaronPDX](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/aaronpdx/32/3226_2.png) [@AaronPDX](https://forums.plex.tv/u/AaronPDX)\
**Post date:** [March 4, 2012, 9:20pm UTC](https://forums.plex.tv/t/php-client-for-plex-media-server/8049/110 "2012-03-04T21:20:04Z")

</div>

“Directory access is forbidden.” error:  
  
  
  
The issue is that you need to not put just the “plex\_over” subfolder into your web server, but actually the whole “Plex-Over” folder. The index file that you should be accessing via web is “index.php” in the Plex-Over folder, NOT “index.html” in plex\_over.  
  
  
  
The directions included with the Plex-Over documentation indicate you should move the “plex\_over” folder, or at least they read that way to me, so I ended up not moving the entire folder, just that subfolder.  
  
  
  
I know this is a bit of a noob error to make, but looks like I’m not the only one that was making it; one previous post in this mentioned it, then just had an “Edit: Fixed”, which I think is the most irritating anything ever.

---

<div class="post-metadata">

**Author:** ![AaronPDX](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/aaronpdx/32/3226_2.png) [@AaronPDX](https://forums.plex.tv/u/AaronPDX)\
**Post date:** [March 5, 2012, 12:17am UTC](https://forums.plex.tv/t/php-client-for-plex-media-server/8049/111 "2012-03-05T00:17:23Z")

</div>

I assume this does work with the latest version of PMS. I’ve got it set up so I can see my media and all, but nothing will actually start streaming, and any attempt to download throws a 404. I’m on Mac OS 10.7, I’m not seeing any of the images for movies/TV shows either (but I gather this is common) and I DO have it set up to log in with myPlex using Eclipse’s fork of the original. I’ve tried with setting transcoding to both true and false.  
  
  
  
Any Mac users out there successfully using this with the most current version of Plex server? Any suggestions at all would be grand.  
  
  
  
edit: So problem seems to lie in not being able to externally control Plex? If I set my $config[‘plex\_url’] = ‘[http://10.0.1.25:32400](http://10.0.1.25:32400)’; it’ll get the images AND do playback without issue (on my local network, of course). If I set it to an externally accessible IP, it won’t do playback even.  
  
  
  
  
  
edit2: So it’s clear the issue is that Plex\_Over is trying to make a connection between the PMS and the user (when not local), and because PMS doesn’t authenticate appropriately to the user, and it’s not possible to turn off the “secure” element… so it won’t stream. I don’t know if anyone else is getting around this somehow. However, since PMS doesn’t try to authenticate when it’s on localhost, I thought perhaps it would be possible to set up some kind of local SSH port tunneling, so that incoming connections are treated locally by PMS and serve up the content through the tunnel back to the external user. I don’t really know enough about SSH tunneling to set that up, but maybe someone else does?

---

<div class="post-metadata">

**Author:** ![dashbad](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/dashbad/32/86287_2.png) [@dashbad](https://forums.plex.tv/u/dashbad)\
**Post date:** [March 14, 2012, 8:13am UTC](https://forums.plex.tv/t/php-client-for-plex-media-server/8049/112 "2012-03-14T08:13:04Z")

</div>

> [@](#):
>
> So I am having this same external problem with no images, etc. I think I can provide a little more information that might be helpful. When I am on my home network I can plug the plexip:32400 into a browser and an xml stream returns from plex with some options defined.   
>   
> I checked that my port is configured with upnp through my router via plex to be some unique port. When I go to the router's external ip address with the port that is open in my router for plex, I get a 401 unauthorized error. I am assuming that for the images/data to load, this needs to be able to return the xml stream from plex to an external client. It looks like I need some more configuration setting/permissions set up to allow external access to plex's data. Is this related?

  
  
  
I'm also having issues when plex\_url is set to an external URL (as it should be). Images don't load and streams don't play though I can download.  
  
I get 401 unauthorized when trying to open the image thumbnail links that plex\_over is generating which suggests that the authentication header is not being sent for these items. It is much the same result as entering ipaddress:32400 directly into a browser.  
  
I can successfully download the stream m3u8 file but the transcode fails. Given the transcode is successful when plex\_url is set to an internal IP (and accessed internally) it would seem that these two issues are related.

---

<div class="post-metadata">

**Author:** ![eclipsenet2k](https://avatars.discourse-cdn.com/v4/letter/e/bcef8e/32.png) [@eclipsenet2k](https://forums.plex.tv/u/eclipsenet2k)\
**Post date:** [March 29, 2012, 12:57pm UTC](https://forums.plex.tv/t/php-client-for-plex-media-server/8049/113 "2012-03-29T12:57:07Z")

</div>

Yeah, I’ve had a lot of other projects on me the past few months so I’ve not had time to throw at this. I need to track down all areas that call back to PMS and append the auth\_token from myPlex onto the URLs, still finding them.  
  
  
  
Greg-

---

<div class="post-metadata">

**Author:** ![nickdanger3d](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/nickdanger3d/32/101122_2.png) [@nickdanger3d](https://forums.plex.tv/u/nickdanger3d)\
**Post date:** [June 6, 2012, 4:05am UTC](https://forums.plex.tv/t/php-client-for-plex-media-server/8049/114 "2012-06-06T04:05:21Z")

</div>

I can’t get past the blank white screen with either the original version or eclipse’s fork. Any ideas? I’ve checked and rechecked my config and user\_pref.  
  
  
  
$config[‘base\_url’] = “[http://plexover/](http://plexover/)”; // (I set up an apache virtual server)  
  
username = i’ve tried blank as well as my myplex info  
  
password = ^ ditto  
  
  
  
plex\_local = [http://192.168.1.104:32400](http://192.168.1.104:32400) (no trailing slash. I also tried creating a tunnel to the other machine and doing localhost:32450)  
  
$config[‘plex\_local’] = ‘[http://localhost:32450](http://localhost:32450)’;  
  
plex\_url = same as local, I don’t need remote access.  
  
$config[‘plex\_url’] = ‘[http://localhost:32450](http://localhost:32450)’;  
  
  
  
EDIT: Fixed. I had to “rewrite short tags”

---

<div class="post-metadata">

**Author:** ![lazybones](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/lazybones/32/3815_2.png) [@lazybones](https://forums.plex.tv/u/lazybones)\
**Post date:** [June 6, 2012, 7:10pm UTC](https://forums.plex.tv/t/php-client-for-plex-media-server/8049/115 "2012-06-06T19:10:23Z")

</div>

> [@](#):
>
> I'm also not sure ATM if html5 audio/video player is the best choice. After [reading this post](http://forums.plexapp.com/index.php/topic/22303-plex-transcode-api/page\_\_view\_\_findpost\_\_p\_\_144128), flash-based player seem's to be more universal, regarding the variety of video/audio codecs.

  
  
I think HTML5 video is ideal as long as you can figure out trans-coding... It isn't that hard to discover which browsers support particular formats.  
  
HTML5 support is growing.  
- Flash never supported on Apple mobile devices  
- Adobe has removed all future mobile Flash support.  
- Microsoft has abandon SilverLight and is moving to HTML5  
- Microsoft just announced Internet Explore for Xbox360 and demoed it playing full screen video.  
  
HTML5 should allow supporting some devices that are not currently supported and my be a better option than DLNA for some that have browsers  
- It would be nice to get all the metadata and art views on the Xbox360 when the IE feature launches  
- Many Playbook owners would like to use plex and it uses a Webkit browser that supports H.264 and Mpeg4 video  
- Mozilla has shown some hints that it may bend to support H.264 in its video player making it the common format for browsers

---

<div class="post-metadata">

**Author:** ![clowrym](https://avatars.discourse-cdn.com/v4/letter/c/f08c70/32.png) [@clowrym](https://forums.plex.tv/u/clowrym)\
**Post date:** [June 8, 2012, 1:48am UTC](https://forums.plex.tv/t/php-client-for-plex-media-server/8049/116 "2012-06-08T01:48:43Z")

</div>

Quote:  
  
Many Playbook owners would like to use plex and it uses a Webkit browser that supports H.264 and Mpeg4 video  
  
  
  
I second this… Plex is excellent… I just wish it was available on my playback!!

---

<div class="post-metadata">

**Author:** ![d2004](https://avatars.discourse-cdn.com/v4/letter/d/a3d4f5/32.png) [@d2004](https://forums.plex.tv/u/d2004)\
**Post date:** [June 15, 2012, 8:55am UTC](https://forums.plex.tv/t/php-client-for-plex-media-server/8049/117 "2012-06-15T08:55:06Z")

</div>

When i try to play the videos nothing happens, when i try to dl them i get “404 Page Not Found The page you requested was not found.”  
  
And in safari i get “401 Unauthorized” when i try to play a video. Any thing i could try to make it work :/?  
  
  
  
Is there still any one who is working on this or is it dead?

---

<div class="post-metadata">

**Author:** ![nickdanger3d](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/nickdanger3d/32/101122_2.png) [@nickdanger3d](https://forums.plex.tv/u/nickdanger3d)\
**Post date:** [June 15, 2012, 12:36pm UTC](https://forums.plex.tv/t/php-client-for-plex-media-server/8049/118 "2012-06-15T12:36:04Z")

</div>

I think we’re all waiting for eclipse to patch that issue. Local videos seem to work fine (at least the last time I tried) but you get the 401s from the token not being set right (or something.) Personally I’m trying to write a similar program in python and I also can’t get the token right. Just try to be patient, eclipse knows people are interested in this.

---

<div class="post-metadata">

**Author:** ![iPerplexed](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/iperplexed/32/844_2.png) [@iPerplexed](https://forums.plex.tv/u/iPerplexed)\
**Post date:** [June 23, 2012, 3:19am UTC](https://forums.plex.tv/t/php-client-for-plex-media-server/8049/119 "2012-06-23T03:19:45Z")

</div>

Hi All,  
  
  
  
I’m beginning to loose faith that this php client will get the jump start it needs. I’m a javascript/python guy and I’ve put nearly 10 hours total into attempting to reverse engineer this thing to no avail. Sadness…  
  
  
  
Anyone know a php guru with a love for Plex? Calling all PHP Plex-heads!! Help!  
  
  
  
Let’s make this thing work!

---

<div class="post-metadata">

**Author:** ![nadocrew](https://avatars.discourse-cdn.com/v4/letter/n/aca169/32.png) [@nadocrew](https://forums.plex.tv/u/nadocrew)\
**Post date:** [June 29, 2012, 5:36pm UTC](https://forums.plex.tv/t/php-client-for-plex-media-server/8049/120 "2012-06-29T17:36:36Z")

</div>

> [@](#):
>
> Hi All,  
>   
> I'm beginning to loose faith that this php client will get the jump start it needs. I'm a javascript/python guy and I've put nearly 10 hours total into attempting to reverse engineer this thing to no avail. Sadness..  
>   
> Anyone know a php guru with a love for Plex? Calling all PHP Plex-heads!! Help!  
>   
> Let's make this thing work!

  
  
Hey, Im a PHP and javascript guru and would be willing to help you out. Let me know how I can help.

[Previous page](https://forums.plex.tv/t/php-client-for-plex-media-server/8049.md?page=5)

[Next page](https://forums.plex.tv/t/php-client-for-plex-media-server/8049.md?page=7)
