# PHP and Wowza to start recording a live stream

**URL:** <https://community.wowza.com/t/php-and-wowza-to-start-recording-a-live-stream/40392>\
**Category:** Wowza Streaming Engine\
**Created:** [May 6, 2013, 1:12am UTC](https://community.wowza.com/t/php-and-wowza-to-start-recording-a-live-stream/40392 "2013-05-06T01:12:38Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alin\_Hordoan](https://avatars.discourse-cdn.com/v4/letter/a/ea5d25/32.png) [@Alin\_Hordoan](https://community.wowza.com/u/Alin_Hordoan)\
**Post date:** [May 6, 2013, 1:12am UTC](https://community.wowza.com/t/php-and-wowza-to-start-recording-a-live-stream/40392/1 "2013-05-06T01:12:38Z")

</div>

To any one that can help.

I am trying from a php script to to launch a url that will start recording on a specific stream i know that the url works because i can try it out side the code and it works.

I have been using fopen() to open the url.

Is there something else that works? All it does know is it times out.

Alin

---

<div class="post-metadata">

**Author:** ![Richard\_Lanham](https://avatars.discourse-cdn.com/v4/letter/r/c68b51/32.png) [@Richard\_Lanham](https://community.wowza.com/u/Richard_Lanham)\
**Post date:** [May 6, 2013, 1:43pm UTC](https://community.wowza.com/t/php-and-wowza-to-start-recording-a-live-stream/40392/2 "2013-05-06T13:43:51Z")

</div>

Alin,

In PHP I think it is the load(url) command.

Richard

---

<div class="post-metadata">

**Author:** ![Richard\_Lanham](https://avatars.discourse-cdn.com/v4/letter/r/c68b51/32.png) [@Richard\_Lanham](https://community.wowza.com/u/Richard_Lanham)\
**Post date:** [May 6, 2013, 5:37pm UTC](https://community.wowza.com/t/php-and-wowza-to-start-recording-a-live-stream/40392/3 "2013-05-06T17:37:47Z")

</div>

Try using “admin-basic” authentication, then you can add in url:

```auto
http://richard:myPwd@[wowza-address]:1935/[httpFilter]

```

Add username and password to /conf/admin.password

Richard

---

<div class="post-metadata">

**Author:** ![Richard\_Lanham](https://avatars.discourse-cdn.com/v4/letter/r/c68b51/32.png) [@Richard\_Lanham](https://community.wowza.com/u/Richard_Lanham)\
**Post date:** [May 8, 2013, 6:16pm UTC](https://community.wowza.com/t/php-and-wowza-to-start-recording-a-live-stream/40392/4 "2013-05-08T18:16:32Z")

</div>

You put the username and password in-line, like this:

```auto
curl_setopt($ch, CURLOPT_URL, "http://richard:myPwd@ip:8086/livestreamrecord?app=live&streamname=myStream_160p &outputFile=04_05_2013M_160p.mp4&startonkeyframe=t rue&action=startRecording");

```

Richard

---

<div class="post-metadata">

**Author:** ![Alin\_Hordoan](https://avatars.discourse-cdn.com/v4/letter/a/ea5d25/32.png) [@Alin\_Hordoan](https://community.wowza.com/u/Alin_Hordoan)\
**Post date:** [May 6, 2013, 9:14am UTC](https://community.wowza.com/t/php-and-wowza-to-start-recording-a-live-stream/40392/5 "2013-05-06T09:14:32Z")

</div>

> Alin,
> 
> In PHP I think it is the load(url) command.
> 
> Richard

I tried it with the load

meaning this command

[http://php.net/manual/en/domdocument.load.php](http://php.net/manual/en/domdocument.load.php)

same error. I also have authentication enabled on the links.

Alin

---

<div class="post-metadata">

**Author:** ![Alin\_Hordoan](https://avatars.discourse-cdn.com/v4/letter/a/ea5d25/32.png) [@Alin\_Hordoan](https://community.wowza.com/u/Alin_Hordoan)\
**Post date:** [May 6, 2013, 11:41am UTC](https://community.wowza.com/t/php-and-wowza-to-start-recording-a-live-stream/40392/6 "2013-05-06T11:41:01Z")

</div>

> Try using “admin-basic” authentication, then you can add in url:
> 
> ```auto
> http://richard:myPwd@[wowza-address]:1935/[httpFilter]
> 
> ```
> 
> Add username and password to /conf/admin.password
> 
> Richard

Richard thank you for your help. But i still can not get it to work.

The link works fine when i paste it in a browser and hit enter, with the “admin-basic” authenication, but when i try to send it from a php script it times out.

I saw that your using port 1935 is that what you recommended?

Alin

---

<div class="post-metadata">

**Author:** ![Alin\_Hordoan](https://avatars.discourse-cdn.com/v4/letter/a/ea5d25/32.png) [@Alin\_Hordoan](https://community.wowza.com/u/Alin_Hordoan)\
**Post date:** [May 6, 2013, 10:59pm UTC](https://community.wowza.com/t/php-and-wowza-to-start-recording-a-live-stream/40392/7 "2013-05-06T22:59:46Z")

</div>

So, I have been doing more research and i still have not been able to figure this out.

Can i use curl to do this?

here is an example of my code

$ch=curl\_init();

curl\_setopt($ch, CURLOPT\_URL, “[http://ip:8086/livestreamrecord?app=live&streamname=myStream\_160p&outputFile=04\_05\_2013M\_160p.mp4&startonkeyframe=true&action=startRecording](http://ip:8086/livestreamrecord?app=live&streamname=myStream_160p&outputFile=04_05_2013M_160p.mp4&startonkeyframe=true&action=startRecording)”);

curl\_setopt($ch, CURLOPT\_HEADER, 0);

curl\_setopt($ch, CURLOPT\_HTTPAUTH, CURLAUTH\_BASIC);

curl\_setopt($ch, CURLOPT\_USERPWD, “Username:Password”);

curl\_exec($ch);

curl\_close($ch);

Please help

Alin
